puzhibing
2024-10-17 201ec7bf9f2b7dec65db6ed02ef6f67cb1dd5851
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TVehicleRampController.java
@@ -1,7 +1,9 @@
package com.ruoyi.chargingPile.controller;
import com.ruoyi.chargingPile.api.model.TParkingLot;
import com.ruoyi.chargingPile.api.model.TVehicleRamp;
import com.ruoyi.chargingPile.service.TParkingLotService;
import com.ruoyi.chargingPile.service.TVehicleRampService;
import com.ruoyi.common.core.utils.CodeGenerateUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
@@ -37,6 +39,9 @@
    
    @Resource
    private SwitchwayGateClient switchwayGateClient;
    @Resource
    private TParkingLotService parkingLotService;
    
    
    
@@ -105,9 +110,13 @@
    @ApiOperation(tags = {"后台-车道"},value = "开关闸车道")
    @PostMapping(value = "/openOrDown")
    public AjaxResult<String> openOrDown(@RequestBody TVehicleRamp dto) {
        TVehicleRamp vehicleRamp = vehicleRampService.getById(dto.getId());
        TParkingLot parkingLot = parkingLotService.getById(vehicleRamp.getParkingLotId());
        SwitchwayGateReq req = new SwitchwayGateReq();
        req.setAction(dto.getAction());
        req.setChannel(dto.getCarportNum());
        req.setAction(vehicleRamp.getAction());
        req.setChannel(vehicleRamp.getCarportNum());
        req.setAppkey(parkingLot.getAppKey());
        req.setSecretkey(parkingLot.getSecretKey());
        Boolean data = switchwayGateClient.gateService(req).getData();
        return data ? AjaxResult.success() : AjaxResult.error("操作失败");
    }