|
@@ -41,7 +41,8 @@ public class ConfigService {
|
|
//* -------------------------------- Comment --------------------------------
|
|
//* -------------------------------- Comment --------------------------------
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 获取车辆配置列表
|
|
|
|
|
|
+ * 获取车辆配置列表
|
|
|
|
+ *
|
|
* @param pageParam
|
|
* @param pageParam
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -50,20 +51,20 @@ public class ConfigService {
|
|
pageParam.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
pageParam.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
|
|
// 私有查询需获取当前人 userId
|
|
// 私有查询需获取当前人 userId
|
|
- if(DictConstants.IS_NOT_SHARED.equals(pageParam.getShare())){
|
|
|
|
|
|
+ if (DictConstants.IS_NOT_SHARED.equals(pageParam.getShare())) {
|
|
pageParam.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
pageParam.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
}
|
|
}
|
|
// 公有查询不需要当前人 userId
|
|
// 公有查询不需要当前人 userId
|
|
- if(DictConstants.IS_SHARED.equals(pageParam.getShare())){
|
|
|
|
|
|
+ if (DictConstants.IS_SHARED.equals(pageParam.getShare())) {
|
|
pageParam.setCreateUserId(null);
|
|
pageParam.setCreateUserId(null);
|
|
}
|
|
}
|
|
List<ConfigVO> list = configMapper.getConfigPageList(pageParam); // 查询《配置-传感器关系表》
|
|
List<ConfigVO> list = configMapper.getConfigPageList(pageParam); // 查询《配置-传感器关系表》
|
|
list.forEach(configVO -> {
|
|
list.forEach(configVO -> {
|
|
List<ConfigSensorVO> sensorList = configMapper.getConfigSensors(configVO); // 根据配置 id 获取传感器列表
|
|
List<ConfigSensorVO> sensorList = configMapper.getConfigSensors(configVO); // 根据配置 id 获取传感器列表
|
|
Map<String, List<ConfigSensorVO>> configSensors = sensorList.stream().collect(Collectors.groupingBy(ConfigSensorVO::getSensorType));
|
|
Map<String, List<ConfigSensorVO>> configSensors = sensorList.stream().collect(Collectors.groupingBy(ConfigSensorVO::getSensorType));
|
|
- Map<String,String> sensorCount = new HashMap<>();
|
|
|
|
- configSensors.forEach((sensorType,configSensorVOs)->{
|
|
|
|
- sensorCount.put(sensorType,String.valueOf(configSensorVOs.size()));
|
|
|
|
|
|
+ Map<String, String> sensorCount = new HashMap<>();
|
|
|
|
+ configSensors.forEach((sensorType, configSensorVOs) -> {
|
|
|
|
+ sensorCount.put(sensorType, String.valueOf(configSensorVOs.size()));
|
|
});
|
|
});
|
|
configVO.setSensorCount(sensorCount);
|
|
configVO.setSensorCount(sensorCount);
|
|
});
|
|
});
|
|
@@ -83,7 +84,7 @@ public class ConfigService {
|
|
ConfigPO configPO = new ConfigPO();
|
|
ConfigPO configPO = new ConfigPO();
|
|
String currentUserId = AuthUtil.getCurrentUserId();
|
|
String currentUserId = AuthUtil.getCurrentUserId();
|
|
Timestamp currentTime = TimeUtil.getNowForMysql();
|
|
Timestamp currentTime = TimeUtil.getNowForMysql();
|
|
- ObjectUtil.voToPo(configVO,configPO);
|
|
|
|
|
|
+ ObjectUtil.voToPo(configVO, configPO);
|
|
configPO.setCreateUserId(currentUserId);
|
|
configPO.setCreateUserId(currentUserId);
|
|
configPO.setCreateTime(currentTime);
|
|
configPO.setCreateTime(currentTime);
|
|
configPO.setModifyUserId(currentUserId);
|
|
configPO.setModifyUserId(currentUserId);
|
|
@@ -94,19 +95,19 @@ public class ConfigService {
|
|
configPO.setDescription(configVO.getConfigDescription());
|
|
configPO.setDescription(configVO.getConfigDescription());
|
|
//名称校验
|
|
//名称校验
|
|
List<ConfigVO> list = configMapper.checkConfigName(configPO);
|
|
List<ConfigVO> list = configMapper.checkConfigName(configPO);
|
|
- if(ObjectUtil.isNotNull(list)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(list)) {
|
|
configPO.setId(null);
|
|
configPO.setId(null);
|
|
return configPO;
|
|
return configPO;
|
|
}
|
|
}
|
|
//主表主键
|
|
//主表主键
|
|
String configId = configPO.getId();
|
|
String configId = configPO.getId();
|
|
- if(ObjectUtil.isNull(configId)){//新增
|
|
|
|
|
|
+ if (ObjectUtil.isNull(configId)) {//新增
|
|
configId = StringUtil.getRandomUUID();
|
|
configId = StringUtil.getRandomUUID();
|
|
configPO.setId(configId);
|
|
configPO.setId(configId);
|
|
configPO.setConfigCode(StringUtil.getRandomCode());
|
|
configPO.setConfigCode(StringUtil.getRandomCode());
|
|
configMapper.insertConfig(configPO);
|
|
configMapper.insertConfig(configPO);
|
|
LogUtil.insert();
|
|
LogUtil.insert();
|
|
- }else{//修改
|
|
|
|
|
|
+ } else {//修改
|
|
configMapper.updateConfig(configPO);
|
|
configMapper.updateConfig(configPO);
|
|
LogUtil.update();
|
|
LogUtil.update();
|
|
}
|
|
}
|
|
@@ -116,12 +117,12 @@ public class ConfigService {
|
|
//List<ConfigSensorVO> configSensorVOs = configVO.getConfigSensors();
|
|
//List<ConfigSensorVO> configSensorVOs = configVO.getConfigSensors();
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
- if(ObjectUtil.isNotNull(configSensors)){
|
|
|
|
- configSensors.forEach((sensorType,configSensorVOs)->{
|
|
|
|
- if(ObjectUtil.isNotNull(configSensorVOs)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(configSensors)) {
|
|
|
|
+ configSensors.forEach((sensorType, configSensorVOs) -> {
|
|
|
|
+ if (ObjectUtil.isNotNull(configSensorVOs)) {
|
|
configSensorVOs.forEach(vo -> {
|
|
configSensorVOs.forEach(vo -> {
|
|
ConfigSensorPO po = new ConfigSensorPO();
|
|
ConfigSensorPO po = new ConfigSensorPO();
|
|
- ObjectUtil.voToPo(vo,po);
|
|
|
|
|
|
+ ObjectUtil.voToPo(vo, po);
|
|
po.setId(StringUtil.getRandomUUID());
|
|
po.setId(StringUtil.getRandomUUID());
|
|
//子表外键
|
|
//子表外键
|
|
po.setConfigId(configPO.getId());
|
|
po.setConfigId(configPO.getId());
|
|
@@ -135,7 +136,7 @@ public class ConfigService {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotNull(configSensorPOs)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(configSensorPOs)) {
|
|
configMapper.insertConfigSensors(configSensorPOs);
|
|
configMapper.insertConfigSensors(configSensorPOs);
|
|
}
|
|
}
|
|
return configPO;
|
|
return configPO;
|
|
@@ -146,7 +147,7 @@ public class ConfigService {
|
|
ConfigPO configPO = new ConfigPO();
|
|
ConfigPO configPO = new ConfigPO();
|
|
String currentUserId = AuthUtil.getCurrentUserId();
|
|
String currentUserId = AuthUtil.getCurrentUserId();
|
|
Timestamp currentTime = TimeUtil.getNowForMysql();
|
|
Timestamp currentTime = TimeUtil.getNowForMysql();
|
|
- ObjectUtil.voToPo(configVO,configPO);
|
|
|
|
|
|
+ ObjectUtil.voToPo(configVO, configPO);
|
|
configPO.setCreateUserId(currentUserId);
|
|
configPO.setCreateUserId(currentUserId);
|
|
configPO.setCreateTime(currentTime);
|
|
configPO.setCreateTime(currentTime);
|
|
configPO.setModifyUserId(currentUserId);
|
|
configPO.setModifyUserId(currentUserId);
|
|
@@ -157,10 +158,10 @@ public class ConfigService {
|
|
configPO.setDescription(configVO.getConfigDescription());
|
|
configPO.setDescription(configVO.getConfigDescription());
|
|
//名称校验
|
|
//名称校验
|
|
List<ConfigVO> list = configMapper.checkConfigName(configPO);
|
|
List<ConfigVO> list = configMapper.checkConfigName(configPO);
|
|
- if(ObjectUtil.isNotNull(list)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(list)) {
|
|
configMapper.updateConfig(configPO);
|
|
configMapper.updateConfig(configPO);
|
|
LogUtil.update();
|
|
LogUtil.update();
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
//主表主键
|
|
//主表主键
|
|
String configId = configPO.getId();
|
|
String configId = configPO.getId();
|
|
configId = StringUtil.getRandomUUID();
|
|
configId = StringUtil.getRandomUUID();
|
|
@@ -176,12 +177,12 @@ public class ConfigService {
|
|
//List<ConfigSensorVO> configSensorVOs = configVO.getConfigSensors();
|
|
//List<ConfigSensorVO> configSensorVOs = configVO.getConfigSensors();
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
- if(ObjectUtil.isNotNull(configSensors)){
|
|
|
|
- configSensors.forEach((sensorType,configSensorVOs)->{
|
|
|
|
- if(ObjectUtil.isNotNull(configSensorVOs)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(configSensors)) {
|
|
|
|
+ configSensors.forEach((sensorType, configSensorVOs) -> {
|
|
|
|
+ if (ObjectUtil.isNotNull(configSensorVOs)) {
|
|
configSensorVOs.forEach(vo -> {
|
|
configSensorVOs.forEach(vo -> {
|
|
ConfigSensorPO po = new ConfigSensorPO();
|
|
ConfigSensorPO po = new ConfigSensorPO();
|
|
- ObjectUtil.voToPo(vo,po);
|
|
|
|
|
|
+ ObjectUtil.voToPo(vo, po);
|
|
po.setId(StringUtil.getRandomUUID());
|
|
po.setId(StringUtil.getRandomUUID());
|
|
//子表外键
|
|
//子表外键
|
|
po.setConfigId(configPO.getId());
|
|
po.setConfigId(configPO.getId());
|
|
@@ -195,7 +196,7 @@ public class ConfigService {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotNull(configSensorPOs)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(configSensorPOs)) {
|
|
configMapper.insertConfigSensors(configSensorPOs);
|
|
configMapper.insertConfigSensors(configSensorPOs);
|
|
}
|
|
}
|
|
return configPO;
|
|
return configPO;
|
|
@@ -203,7 +204,7 @@ public class ConfigService {
|
|
|
|
|
|
public int delConfigById(ConfigVO vo) {
|
|
public int delConfigById(ConfigVO vo) {
|
|
ConfigPO po = new ConfigPO();
|
|
ConfigPO po = new ConfigPO();
|
|
- ObjectUtil.voToPo(vo,po);
|
|
|
|
|
|
+ ObjectUtil.voToPo(vo, po);
|
|
po.setIsDeleted(DictConstants.YES);
|
|
po.setIsDeleted(DictConstants.YES);
|
|
po.setModifyUserId(AuthUtil.getCurrentUserId());
|
|
po.setModifyUserId(AuthUtil.getCurrentUserId());
|
|
po.setModifyTime(TimeUtil.getNowForMysql());
|
|
po.setModifyTime(TimeUtil.getNowForMysql());
|
|
@@ -215,7 +216,7 @@ public class ConfigService {
|
|
public ConfigPO shareConfigByInfo(ConfigVO configVO) {
|
|
public ConfigPO shareConfigByInfo(ConfigVO configVO) {
|
|
//构建主表对象
|
|
//构建主表对象
|
|
ConfigPO configPO = new ConfigPO();
|
|
ConfigPO configPO = new ConfigPO();
|
|
- ObjectUtil.voToPo(configVO,configPO);
|
|
|
|
|
|
+ ObjectUtil.voToPo(configVO, configPO);
|
|
configPO.setShare(DictConstants.YES);//转公有
|
|
configPO.setShare(DictConstants.YES);//转公有
|
|
configPO.setCreateUserId(null);
|
|
configPO.setCreateUserId(null);
|
|
|
|
|
|
@@ -223,14 +224,14 @@ public class ConfigService {
|
|
Timestamp currentTime = TimeUtil.getNowForMysql();
|
|
Timestamp currentTime = TimeUtil.getNowForMysql();
|
|
//名称校验
|
|
//名称校验
|
|
List<ConfigVO> list = configMapper.checkConfigName(configPO);
|
|
List<ConfigVO> list = configMapper.checkConfigName(configPO);
|
|
- if(ObjectUtil.isNotNull(list)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(list)) {
|
|
configPO.setModifyUserId(currentUserId);
|
|
configPO.setModifyUserId(currentUserId);
|
|
configPO.setModifyTime(currentTime);
|
|
configPO.setModifyTime(currentTime);
|
|
configPO.setIsDeleted(DictConstants.NO);
|
|
configPO.setIsDeleted(DictConstants.NO);
|
|
configMapper.updateConfig(configPO);
|
|
configMapper.updateConfig(configPO);
|
|
LogUtil.update();
|
|
LogUtil.update();
|
|
|
|
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
configPO.setCreateUserId(currentUserId);
|
|
configPO.setCreateUserId(currentUserId);
|
|
configPO.setCreateTime(currentTime);
|
|
configPO.setCreateTime(currentTime);
|
|
configPO.setModifyUserId(currentUserId);
|
|
configPO.setModifyUserId(currentUserId);
|
|
@@ -245,7 +246,7 @@ public class ConfigService {
|
|
configMapper.insertConfig(configPO);
|
|
configMapper.insertConfig(configPO);
|
|
}
|
|
}
|
|
//复制车辆表旧数据
|
|
//复制车辆表旧数据
|
|
- if(configPO.getVehicleId() != null){
|
|
|
|
|
|
+ if (configPO.getVehicleId() != null) {
|
|
VehicleParam vehicleParam = new VehicleParam();
|
|
VehicleParam vehicleParam = new VehicleParam();
|
|
vehicleParam.setId(configPO.getVehicleId());
|
|
vehicleParam.setId(configPO.getVehicleId());
|
|
VehicleVO vehicleInfo = vehicleMapper.getVehicleInfo(vehicleParam);
|
|
VehicleVO vehicleInfo = vehicleMapper.getVehicleInfo(vehicleParam);
|
|
@@ -257,15 +258,15 @@ public class ConfigService {
|
|
|
|
|
|
//构建字表新数据
|
|
//构建字表新数据
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
- System.out.println(" //构建字表新数据---------"+configSensors);
|
|
|
|
|
|
+ System.out.println(" //构建字表新数据---------" + configSensors);
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
List<ConfigSensorPO> configSensorPOs = new ArrayList<>();
|
|
- if(CollectionUtil.isNotEmpty(configSensors)){
|
|
|
|
- configSensors.forEach((sensorType,configSensorVOs)->{
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(configSensors)) {
|
|
|
|
+ configSensors.forEach((sensorType, configSensorVOs) -> {
|
|
|
|
|
|
- if(ObjectUtil.isNotNull(configSensorVOs)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(configSensorVOs)) {
|
|
configSensorVOs.forEach(vo -> {
|
|
configSensorVOs.forEach(vo -> {
|
|
ConfigSensorPO po = new ConfigSensorPO();
|
|
ConfigSensorPO po = new ConfigSensorPO();
|
|
- ObjectUtil.voToPo(vo,po);
|
|
|
|
|
|
+ ObjectUtil.voToPo(vo, po);
|
|
po.setId(StringUtil.getRandomUUID());
|
|
po.setId(StringUtil.getRandomUUID());
|
|
//子表外键
|
|
//子表外键
|
|
po.setConfigId(configPO.getId());
|
|
po.setConfigId(configPO.getId());
|
|
@@ -282,48 +283,49 @@ public class ConfigService {
|
|
cameraParam.setId(vo.getSensorId());
|
|
cameraParam.setId(vo.getSensorId());
|
|
CameraVO cameraVO = cameraService.getCameraInfo(cameraParam);
|
|
CameraVO cameraVO = cameraService.getCameraInfo(cameraParam);
|
|
CameraPO cameraPO = new CameraPO();
|
|
CameraPO cameraPO = new CameraPO();
|
|
- ObjectUtil.voToPo(cameraVO,cameraPO);
|
|
|
|
|
|
+ ObjectUtil.voToPo(cameraVO, cameraPO);
|
|
CameraPO cameraPO1 = cameraService.shareCamera(cameraPO);
|
|
CameraPO cameraPO1 = cameraService.shareCamera(cameraPO);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- case "lidar":{
|
|
|
|
|
|
+ case "lidar": {
|
|
LidarParam lidarParam = new LidarParam();
|
|
LidarParam lidarParam = new LidarParam();
|
|
lidarParam.setId(vo.getSensorId());
|
|
lidarParam.setId(vo.getSensorId());
|
|
LidarVO lidarVO = lidarService.getLidarInfo(lidarParam);
|
|
LidarVO lidarVO = lidarService.getLidarInfo(lidarParam);
|
|
LidarPO lidarPO = new LidarPO();
|
|
LidarPO lidarPO = new LidarPO();
|
|
- ObjectUtil.voToPo(lidarVO,lidarPO);
|
|
|
|
|
|
+ ObjectUtil.voToPo(lidarVO, lidarPO);
|
|
LidarPO lidarPO1 = lidarService.shareLidar(lidarPO);
|
|
LidarPO lidarPO1 = lidarService.shareLidar(lidarPO);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- case "ogt":{
|
|
|
|
|
|
+ case "ogt": {
|
|
OgtParam ogtParam = new OgtParam();
|
|
OgtParam ogtParam = new OgtParam();
|
|
ogtParam.setId(vo.getSensorId());
|
|
ogtParam.setId(vo.getSensorId());
|
|
OgtVO ogtVO = ogtService.getOgtInfo(ogtParam);
|
|
OgtVO ogtVO = ogtService.getOgtInfo(ogtParam);
|
|
OgtPO ogtPO = new OgtPO();
|
|
OgtPO ogtPO = new OgtPO();
|
|
- ObjectUtil.voToPo(ogtVO,ogtPO);
|
|
|
|
|
|
+ ObjectUtil.voToPo(ogtVO, ogtPO);
|
|
OgtPO ogtPO1 = ogtService.shareOgt(ogtPO);
|
|
OgtPO ogtPO1 = ogtService.shareOgt(ogtPO);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- case "gps":{
|
|
|
|
|
|
+ case "gps": {
|
|
GpsParam gpsParam = new GpsParam();
|
|
GpsParam gpsParam = new GpsParam();
|
|
gpsParam.setId(vo.getSensorId());
|
|
gpsParam.setId(vo.getSensorId());
|
|
GpsVO gpsVO = gpsService.getGpsInfo(gpsParam);
|
|
GpsVO gpsVO = gpsService.getGpsInfo(gpsParam);
|
|
GpsPO gpsPO = new GpsPO();
|
|
GpsPO gpsPO = new GpsPO();
|
|
- ObjectUtil.voToPo(gpsVO,gpsPO);
|
|
|
|
|
|
+ ObjectUtil.voToPo(gpsVO, gpsPO);
|
|
GpsPO gpsPO1 = gpsService.shareGps(gpsPO);
|
|
GpsPO gpsPO1 = gpsService.shareGps(gpsPO);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- case "radar":{
|
|
|
|
|
|
+ case "radar": {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- default:break;
|
|
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotNull(configSensorPOs)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(configSensorPOs)) {
|
|
configMapper.insertConfigSensors(configSensorPOs);
|
|
configMapper.insertConfigSensors(configSensorPOs);
|
|
}
|
|
}
|
|
return configPO;
|
|
return configPO;
|
|
@@ -336,7 +338,7 @@ public class ConfigService {
|
|
return configPO;
|
|
return configPO;
|
|
}
|
|
}
|
|
|
|
|
|
- public int getConfigTotal(){
|
|
|
|
|
|
+ public int getConfigTotal() {
|
|
return configMapper.getConfigTotal(AuthUtil.getCurrentUserId());
|
|
return configMapper.getConfigTotal(AuthUtil.getCurrentUserId());
|
|
}
|
|
}
|
|
}
|
|
}
|