| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.query.ParkingRecordQuery; |
| | | import com.ruoyi.chargingPile.api.vo.GetParkingRecord; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordVO; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordPageQuery; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.chargingPile.service.TParkingRecordService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | private TParkingLotService parkingLotService; |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "列表") |
| | | @GetMapping(value = "/page") |
| | | @PostMapping(value = "/page") |
| | | public R<Page<TParkingRecord>> page(@RequestBody ParkingRecordPageQuery query) { |
| | | Page<TParkingRecord> page = parkingRecordService.lambdaQuery().ge(query.getStart() != null, TParkingRecord::getCreateTime, query.getStart()) |
| | | .le(query.getEnd() != null, TParkingRecord::getCreateTime, query.getEnd()) |
| | |
| | | |
| | | for (TParkingRecord record : page.getRecords()) { |
| | | record.setName(parkingLotService.getById(record.getParkingLotId()).getName()); |
| | | record.setUid(record.getId().toString()); |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "停车缴费订单列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TParkingRecordPageInfoVO>> pageList(@RequestBody ParkingRecordQuery query) { |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "详情") |
| | | @GetMapping(value = "/detail") |
| | | public R<TParkingRecord> detail(Long id) { |
| | | |
| | | return R.ok(parkingRecordService.getById(id)); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "出场") |
| | | @GetMapping(value = "/out") |
| | | public R out(Long id) { |
| | | TParkingRecord byId = parkingRecordService.getById(id); |
| | | byId.setStatus(2); |
| | | parkingRecordService.updateById(byId); |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据车牌和状态查询停车数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/getParkingRecord") |
| | | public R<TParkingRecord> getParkingRecord(@RequestBody GetParkingRecord query){ |
| | | TParkingRecord one = parkingRecordService.getOne(new LambdaQueryWrapper<TParkingRecord>() |
| | | .eq(TParkingRecord::getLicensePlate, query.getLicensePlate()).eq(TParkingRecord::getStatus, query.getStatus())); |
| | | return R.ok(one); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改停车数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/updateParkingRecord") |
| | | public void updateParkingRecord(@RequestBody TParkingRecord parkingRecord){ |
| | | parkingRecordService.updateById(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getParkingRecordById") |
| | | public R<TParkingRecord> getParkingRecordById(@RequestParam("id") Long id){ |
| | | TParkingRecord parkingRecord = parkingRecordService.getById(id); |
| | | return R.ok(parkingRecord); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * @param parkingRecord |
| | | */ |
| | | @PostMapping("/addParkingRecord") |
| | | public void addParkingRecord(@RequestBody TParkingRecord parkingRecord){ |
| | | parkingRecordService.save(parkingRecord); |
| | | } |
| | | } |
| | | |