longz
2026-07-30 e2ec753e232106f336894f58d585e58c27bf1f29
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingLotController.java
@@ -15,6 +15,7 @@
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;
@@ -33,6 +34,7 @@
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -89,6 +91,7 @@
    @ApiOperation(tags = {"后台-停车场"},value = "添加停车场")
    @PostMapping(value = "/add")
    public AjaxResult<Boolean> add(@RequestBody TParkingLotDTO dto) {
        validateBarrierBrand(dto);
        return AjaxResult.ok(parkingLotService.save(dto));
    }
@@ -100,7 +103,14 @@
    @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("顺捷道闸品牌仅支持直营停车场");
        }
    }
    /**
@@ -158,6 +168,19 @@
    }
    
    
    /**
     * 获取所有停车场数据
     */
    @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){
@@ -167,8 +190,8 @@
    
    
    @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);
    }
    
@@ -184,5 +207,22 @@
                .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);
    }
}