| | |
| | | import com.ruoyi.chargingPile.service.TParkingRecordService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import java.time.LocalDate; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiOperation(tags = {"后台-停车场"},value = "添加停车场") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TParkingLotDTO dto) { |
| | | validateBarrierBrand(dto); |
| | | return AjaxResult.ok(parkingLotService.save(dto)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(tags = {"后台-停车场"},value = "修改停车场") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TParkingLotDTO dto) { |
| | | validateBarrierBrand(dto); |
| | | return AjaxResult.ok(parkingLotService.updateById(dto)); |
| | | } |
| | | |
| | | private void validateBarrierBrand(TParkingLotDTO dto) { |
| | | if (Integer.valueOf(1).equals(dto.getBarrierBrand()) && !Integer.valueOf(1).equals(dto.getType())) { |
| | | throw new ServiceException("顺捷道闸品牌仅支持直营停车场"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取所有停车场数据 |
| | | */ |
| | | @PostMapping(value = "/getAllParkingLot") |
| | | public R<List<TParkingLot>> getAllParkingLot(){ |
| | | List<TParkingLot> list = parkingLotService.list(new LambdaQueryWrapper<TParkingLot>() |
| | | .eq(TParkingLot::getDelFlag, 0)); |
| | | return R.fail(list); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/paymentOrder/order"}, logical = Logical.OR) |
| | | @GetMapping(value = "/getRecordById") |
| | | public R<TParkingRecord> getRecordById(@RequestParam("id") Long id){ |
| | |
| | | |
| | | |
| | | @PostMapping(value = "/getRecordAmount") |
| | | public R<BigDecimal> getRecordAmount(@RequestParam("sixBefore") LocalDate sixBefore){ |
| | | BigDecimal sum = parkingRecordService.getSum(sixBefore); |
| | | public R<BigDecimal> getRecordAmount(@RequestParam(value = "siteIds", required = false) List<Integer> siteIds){ |
| | | BigDecimal sum = parkingRecordService.getSum(siteIds); |
| | | return R.ok(sum); |
| | | } |
| | | |
| | |
| | | .eq(TParkingLot::getAppKey, appKey).eq(TParkingLot::getDelFlag, 0)); |
| | | return R.ok(parkingLot); |
| | | } |
| | | @PostMapping(value = "/getSiteIdByOrderId") |
| | | R<Integer> getSiteIdByOrderId(@RequestParam("id") Long id){ |
| | | TParkingRecord byId = parkingRecordService.getById(id); |
| | | TParkingLot parkingLot = parkingLotService.getById(byId.getParkingLotId()); |
| | | return R.ok(parkingLot.getSiteId()); |
| | | } |
| | | @PostMapping(value = "/getSiteIdAll") |
| | | R<List<TParkingRecord>> getSiteIdAll(){ |
| | | List<TParkingRecord> list = parkingRecordService.list(); |
| | | for (TParkingRecord tParkingRecord : list) { |
| | | TParkingLot parkingLot = parkingLotService.getById(tParkingRecord.getParkingLotId()); |
| | | if (parkingLot!=null){ |
| | | tParkingRecord.setSiteId(parkingLot.getSiteId()); |
| | | } |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | } |
| | | |