|
|
@@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeansException;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.context.ApplicationContextAware;
|
|
|
+import org.springframework.jdbc.UncategorizedSQLException;
|
|
|
import org.springframework.lang.Nullable;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -104,7 +105,7 @@ public class TransferVehicleManage implements ApplicationContextAware {
|
|
|
.stream()
|
|
|
.map(VehicleData::getCarNo)
|
|
|
.collect(Collectors.toList());
|
|
|
- log.info("查询关系数据库中已存在的车牌,结果:{}",existCarNos);
|
|
|
+ log.info("查询关系数据库中已存在的车牌,结果:{}", existCarNos);
|
|
|
|
|
|
|
|
|
// 3. 筛选出需要新增的车辆
|
|
|
@@ -162,6 +163,14 @@ public class TransferVehicleManage implements ApplicationContextAware {
|
|
|
if (request == null || (StringUtils.isEmpty(request.getCarNo()))) {
|
|
|
throw new IotException(ErrorCodeEnum.ILLEGAL_PARAM, "车牌carNo不能为空!");
|
|
|
}
|
|
|
+
|
|
|
+ // 查询车辆id关系数据中是否存在
|
|
|
+ VehicleData vehicleData = vehicleDataService.getOne(Wrappers.<VehicleData>lambdaQuery().eq(VehicleData::getCarNo, request.getCarNo()));
|
|
|
+ if (vehicleData == null) {
|
|
|
+ log.info("子表 {} 不存在,返回空结果", "vehicle_data_" + request.getCarNo().trim());
|
|
|
+ return new VehicleDataResp();
|
|
|
+ }
|
|
|
+
|
|
|
String subTableName = "vehicle_data_" + request.getCarNo().trim();
|
|
|
VehicleTimeSeriesData realTimeLocation = taosService.selectRealTimeLocation(subTableName, request.getCarNo());
|
|
|
|