|
@@ -229,7 +229,7 @@ public class ConfigService {
|
|
|
|
|
|
final String isUnavailable = modelConfigMapper.selectIsUnavailableByModelConfigId(configVO.getId());
|
|
|
if (DictConstants.IS_UNAVAILABLE.equals(isUnavailable)) {
|
|
|
- throw new RuntimeException("车辆配置处于禁用状态,请先保存。");
|
|
|
+ throw new RuntimeException("车辆配置处于禁用状态,请编辑后重试。");
|
|
|
}
|
|
|
|
|
|
// 构建新的车辆配置对象
|
|
@@ -259,8 +259,6 @@ public class ConfigService {
|
|
|
}
|
|
|
|
|
|
// 复制传感器表数据
|
|
|
-
|
|
|
- // 构建字表新数据
|
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
|
log.info("该车辆配置的所有传感器信息为:" + configSensors);
|
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
@@ -279,51 +277,44 @@ public class ConfigService {
|
|
|
po.setModifyUserId(currentUserId);
|
|
|
po.setModifyTime(currentTime);
|
|
|
po.setIsDeleted(DictConstants.NO);
|
|
|
- configSensorPOs.add(po);
|
|
|
-
|
|
|
- switch (sensorType) {
|
|
|
- case "camera": {
|
|
|
- CameraParam cameraParam = new CameraParam();
|
|
|
- cameraParam.setId(vo.getSensorId());
|
|
|
- CameraVO cameraVO = cameraService.getCameraInfo(cameraParam);
|
|
|
- CameraPO cameraPO = new CameraPO();
|
|
|
- ObjectUtil.voToPo(cameraVO, cameraPO);
|
|
|
- CameraPO cameraPO1 = cameraService.shareCamera(cameraPO);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "lidar": {
|
|
|
- LidarParam lidarParam = new LidarParam();
|
|
|
- lidarParam.setId(vo.getSensorId());
|
|
|
- LidarVO lidarVO = lidarService.getLidarInfo(lidarParam);
|
|
|
- LidarPO lidarPO = new LidarPO();
|
|
|
- ObjectUtil.voToPo(lidarVO, lidarPO);
|
|
|
- LidarPO lidarPO1 = lidarService.shareLidar(lidarPO);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "ogt": {
|
|
|
- OgtParam ogtParam = new OgtParam();
|
|
|
- ogtParam.setId(vo.getSensorId());
|
|
|
- OgtVO ogtVO = ogtService.getOgtInfo(ogtParam);
|
|
|
- OgtPO ogtPO = new OgtPO();
|
|
|
- ObjectUtil.voToPo(ogtVO, ogtPO);
|
|
|
- OgtPO ogtPO1 = ogtService.shareOgt(ogtPO);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "gps": {
|
|
|
- GpsParam gpsParam = new GpsParam();
|
|
|
- gpsParam.setId(vo.getSensorId());
|
|
|
- GpsVO gpsVO = gpsService.getGpsInfo(gpsParam);
|
|
|
- GpsPO gpsPO = new GpsPO();
|
|
|
- ObjectUtil.voToPo(gpsVO, gpsPO);
|
|
|
- GpsPO gpsPO1 = gpsService.shareGps(gpsPO);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "radar": {
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
+ String sensorId = "";
|
|
|
+ if (DictConstants.SENSOR_CAMERA.equals(sensorType)) {
|
|
|
+ CameraParam cameraParam = new CameraParam();
|
|
|
+ cameraParam.setId(vo.getSensorId());
|
|
|
+ CameraVO cameraVO = cameraService.getCameraInfo(cameraParam);
|
|
|
+ CameraPO cameraPO = new CameraPO();
|
|
|
+ ObjectUtil.voToPo(cameraVO, cameraPO);
|
|
|
+ CameraPO publicCamera = cameraService.shareCamera(cameraPO);
|
|
|
+ sensorId = publicCamera.getId();
|
|
|
+ } else if (DictConstants.SENSOR_LIDAR.equals(sensorType)) {
|
|
|
+ LidarParam lidarParam = new LidarParam();
|
|
|
+ lidarParam.setId(vo.getSensorId());
|
|
|
+ LidarVO lidarVO = lidarService.getLidarInfo(lidarParam);
|
|
|
+ LidarPO lidarPO = new LidarPO();
|
|
|
+ ObjectUtil.voToPo(lidarVO, lidarPO);
|
|
|
+ LidarPO publicLidar = lidarService.shareLidar(lidarPO);
|
|
|
+ sensorId = publicLidar.getId();
|
|
|
+ } else if (DictConstants.SENSOR_OGT.equals(sensorType)) {
|
|
|
+ OgtParam ogtParam = new OgtParam();
|
|
|
+ ogtParam.setId(vo.getSensorId());
|
|
|
+ OgtVO ogtVO = ogtService.getOgtInfo(ogtParam);
|
|
|
+ OgtPO ogtPO = new OgtPO();
|
|
|
+ ObjectUtil.voToPo(ogtVO, ogtPO);
|
|
|
+ OgtPO publicOgt = ogtService.shareOgt(ogtPO);
|
|
|
+ sensorId = publicOgt.getId();
|
|
|
+ } else if (DictConstants.SENSOR_GPS.equals(sensorType)) {
|
|
|
+ GpsParam gpsParam = new GpsParam();
|
|
|
+ gpsParam.setId(vo.getSensorId());
|
|
|
+ GpsVO gpsVO = gpsService.getGpsInfo(gpsParam);
|
|
|
+ GpsPO gpsPO = new GpsPO();
|
|
|
+ ObjectUtil.voToPo(gpsVO, gpsPO);
|
|
|
+ GpsPO publicGps = gpsService.shareGps(gpsPO);
|
|
|
+ sensorId = publicGps.getId();
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("传感器类型错误。");
|
|
|
}
|
|
|
+ po.setSensorId(sensorId);
|
|
|
+ configSensorPOs.add(po);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -376,12 +367,6 @@ public class ConfigService {
|
|
|
}
|
|
|
|
|
|
public ConfigPO shareConfigById(ConfigVO configVO) {
|
|
|
- //1 已禁用配置不允许删除
|
|
|
- final String isUnavailable = modelConfigMapper.selectIsUnavailableByModelConfigId(configVO.getId());
|
|
|
- if (DictConstants.IS_UNAVAILABLE.equals(isUnavailable)) {
|
|
|
- throw new RuntimeException("车辆配置处于禁用状态。");
|
|
|
- }
|
|
|
- //2 获取配置信息
|
|
|
configVO = getConfigInfo(configVO);
|
|
|
ConfigPO configPO = shareConfigByInfo(configVO);
|
|
|
LogUtil.share();
|