Commit 3931d931 by chenxi

实现功能:修改读取实时监测数据接口传参

1 parent 1b287c2a
...@@ -13,7 +13,6 @@ import io.swagger.v3.oas.annotations.Operation; ...@@ -13,7 +13,6 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -33,15 +32,20 @@ public class GetDataController extends BaseController { ...@@ -33,15 +32,20 @@ public class GetDataController extends BaseController {
@Operation(summary = "读取实时监测数据", description = "读取实时监测数据") @Operation(summary = "读取实时监测数据", description = "读取实时监测数据")
@GetMapping("/get") @GetMapping("/get")
public R<Boolean> getRealTimeData(@RequestParam String pileId, @RequestParam String gunNumber) { public R<Boolean> getRealTimeData(@RequestParam String pileId, @RequestParam String gunNumber) {
try {
log.info("读取实时监测数据,充电桩编号:{}", pileId); log.info("读取实时监测数据,充电桩编号:{}", pileId);
log.info("读取实时监测数据,枪号:{}", gunNumber); log.info("读取实时监测数据,枪号:{}", gunNumber);
RealTimeReq req = new RealTimeReq(); RealTimeReq req = new RealTimeReq();
RealTimeDataReqData data = new RealTimeDataReqData(); RealTimeDataReqData data = new RealTimeDataReqData();
data.setPileId(Ocpp16Helper.strToBcd(pileId, data.getPileId())); data.setPileId(Ocpp16Helper.strToBcd(pileId, data.getPileId()));
data.setGunNumber(Ocpp16Helper.strToBcd(gunNumber, new byte[] {})[0]); data.setGunNumber(Ocpp16Helper.strToBcd(gunNumber, new byte[1])[0]);
TcpCallback<TcpRsp> tcpRspTcpCallback = ServerMain.getServer().sendSync(req); TcpCallback<TcpRsp> tcpRspTcpCallback = ServerMain.getServer().sendSync(req);
TcpRsp tcpRsp = tcpRspTcpCallback.get(); TcpRsp tcpRsp = tcpRspTcpCallback.get();
return R.ok().data(tcpRsp); return R.ok().data(tcpRsp);
} catch (Exception e) {
log.error("读取实时监测数据error:{}", e.getMessage());
}
return R.ok();
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!