Browse Source

查询实时车辆经纬度入参改造

donglang 2 months ago
parent
commit
309d01622a

+ 2 - 2
iot-platform-manager/src/main/java/com/platform/api/controller/TransferController.java

@@ -51,8 +51,8 @@ public class TransferController {
      * 通过车牌查询实时经纬度
      */
     @PostMapping("/queryRealTimeLocation")
-    public BaseResult<VehicleDataResp> queryRealTimeLocation(@NotBlank(message = "车牌carNo不能为空") @Validated String carNo) {
-        return BaseResult.success(transferVehicleManage.queryRealTimeLocation(carNo));
+    public BaseResult<VehicleDataResp> queryRealTimeLocation(@RequestBody VehicleDataRequest request) {
+        return BaseResult.success(transferVehicleManage.queryRealTimeLocation(request));
     }
 
 

+ 6 - 3
iot-platform-manager/src/main/java/com/platform/api/manager/TransferVehicleManage.java

@@ -166,9 +166,12 @@ public class TransferVehicleManage implements ApplicationContextAware {
     /**
      * 通过车牌查询实时经纬度
      */
-    public VehicleDataResp queryRealTimeLocation(String carNo) {
-        String subTableName = "vehicle_data_" + carNo.trim();
-        VehicleTimeSeriesData realTimeLocation = taosService.selectRealTimeLocation(subTableName, carNo);
+    public VehicleDataResp queryRealTimeLocation(VehicleDataRequest request) {
+        if (request == null || (StringUtils.isEmpty(request.getCarNo()))) {
+            throw new IotException(ErrorCodeEnum.ILLEGAL_PARAM, "车牌carNo不能为空!");
+        }
+        String subTableName = "vehicle_data_" + request.getCarNo().trim();
+        VehicleTimeSeriesData realTimeLocation = taosService.selectRealTimeLocation(subTableName, request.getCarNo());
 
         //参数转换
         return VehicleDataResp.toIotPageResp(realTimeLocation);