|
@@ -11,6 +11,7 @@ import com.css.simulation.resource.model.mapper.ConfigMapper;
|
|
import com.css.simulation.resource.model.mapper.RelationConfigSensorMapper;
|
|
import com.css.simulation.resource.model.mapper.RelationConfigSensorMapper;
|
|
import com.css.simulation.resource.model.mapper.VehicleMapper;
|
|
import com.css.simulation.resource.model.mapper.VehicleMapper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -21,6 +22,7 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
+@Slf4j
|
|
@Service
|
|
@Service
|
|
public class ConfigService {
|
|
public class ConfigService {
|
|
|
|
|
|
@@ -45,9 +47,6 @@ public class ConfigService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取车辆配置列表
|
|
* 获取车辆配置列表
|
|
- *
|
|
|
|
- * @param pageParam
|
|
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
public PageInfo<ConfigVO> getConfigPageList(ConfigPageParam pageParam) {
|
|
public PageInfo<ConfigVO> getConfigPageList(ConfigPageParam pageParam) {
|
|
PageUtil.setPageInfo(pageParam);
|
|
PageUtil.setPageInfo(pageParam);
|
|
@@ -231,7 +230,8 @@ public class ConfigService {
|
|
// 传感器模型名称相同则覆盖,名称不同则新增
|
|
// 传感器模型名称相同则覆盖,名称不同则新增
|
|
List<ConfigVO> list = configMapper.checkConfigName(configPO); // 查询公有车辆配置是否有重名
|
|
List<ConfigVO> list = configMapper.checkConfigName(configPO); // 查询公有车辆配置是否有重名
|
|
if (ObjectUtil.isNotNull(list)) { // 不为空说明有重名,则将参数覆盖,同时需要删除配置传感器关联表
|
|
if (ObjectUtil.isNotNull(list)) { // 不为空说明有重名,则将参数覆盖,同时需要删除配置传感器关联表
|
|
-
|
|
|
|
|
|
+ ConfigVO configVO2 = list.get(0);
|
|
|
|
+ configPO.setId(configVO2.getId());
|
|
configPO.setModifyUserId(currentUserId);
|
|
configPO.setModifyUserId(currentUserId);
|
|
configPO.setModifyTime(currentTime);
|
|
configPO.setModifyTime(currentTime);
|
|
configPO.setIsDeleted(DictConstants.NO);
|
|
configPO.setIsDeleted(DictConstants.NO);
|
|
@@ -264,7 +264,7 @@ public class ConfigService {
|
|
|
|
|
|
// 构建字表新数据
|
|
// 构建字表新数据
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
- System.out.println(" //构建字表新数据---------" + configSensors);
|
|
|
|
|
|
+ log.info("该车辆配置的所有传感器信息为:" + configSensors);
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
if (CollectionUtil.isNotEmpty(configSensors)) {
|
|
if (CollectionUtil.isNotEmpty(configSensors)) {
|
|
configSensors.forEach((sensorType, configSensorVOs) -> {
|
|
configSensors.forEach((sensorType, configSensorVOs) -> {
|
|
@@ -331,7 +331,9 @@ public class ConfigService {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
if (ObjectUtil.isNotNull(configSensorPOs)) {
|
|
if (ObjectUtil.isNotNull(configSensorPOs)) {
|
|
|
|
+ log.info("即将保存的传感器信息为:" + configSensorPOs);
|
|
relationConfigSensorMapper.deleteByConfigId(configPO.getId()); // 删除配置与传感器关联关系,方便后面重新添加
|
|
relationConfigSensorMapper.deleteByConfigId(configPO.getId()); // 删除配置与传感器关联关系,方便后面重新添加
|
|
configMapper.insertConfigSensors(configSensorPOs);
|
|
configMapper.insertConfigSensors(configSensorPOs);
|
|
}
|
|
}
|
|
@@ -339,6 +341,7 @@ public class ConfigService {
|
|
}
|
|
}
|
|
|
|
|
|
public ConfigPO shareConfigById(ConfigVO configVO) {
|
|
public ConfigPO shareConfigById(ConfigVO configVO) {
|
|
|
|
+ // 获取配置信息
|
|
configVO = getConfigInfo(configVO);
|
|
configVO = getConfigInfo(configVO);
|
|
ConfigPO configPO = shareConfigByInfo(configVO);
|
|
ConfigPO configPO = shareConfigByInfo(configVO);
|
|
LogUtil.share();
|
|
LogUtil.share();
|