feat: 设备管理添加经纬度以及高度和租户
This commit is contained in:
+10
@@ -62,6 +62,16 @@ public class ThreeDModelFileController {
|
||||
return Result.succeed(modelFileService.getByTourismId(tourismId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备SN获取模型列表
|
||||
*/
|
||||
@GetMapping("/device/{deviceSn}")
|
||||
@Operation(summary = "根据设备SN获取模型列表")
|
||||
public Result<List<ThreeDModelFileVO>> getByDeviceSn(
|
||||
@Parameter(description = "设备SN") @PathVariable String deviceSn) {
|
||||
return Result.succeed(modelFileService.getByDeviceSn(deviceSn));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有可用模型(用于3D地图加载)
|
||||
*/
|
||||
|
||||
+9
@@ -38,6 +38,15 @@ public interface ThreeDModelFileMapper extends SuperMapper<ThreeDModelFile> {
|
||||
@Select("SELECT * FROM 3d_model_file WHERE tourism_id = #{tourismId} AND is_del = 0 AND status = 1 ORDER BY create_time DESC")
|
||||
List<ThreeDModelFile> findByTourismId(@Param("tourismId") Long tourismId);
|
||||
|
||||
/**
|
||||
* 根据设备SN查询模型列表
|
||||
*
|
||||
* @param deviceSn 设备SN
|
||||
* @return 模型列表
|
||||
*/
|
||||
@Select("SELECT * FROM 3d_model_file WHERE device_sn = #{deviceSn} AND is_del = 0 AND status = 1 ORDER BY create_time DESC")
|
||||
List<ThreeDModelFile> findByDeviceSn(@Param("deviceSn") String deviceSn);
|
||||
|
||||
/**
|
||||
* 根据工作空间ID查询模型列表
|
||||
*
|
||||
|
||||
@@ -55,4 +55,24 @@ public class AgeDevice extends SuperEntity {
|
||||
* 设备推送视频流地址(完整whip URL,如:http://220.205.16.27:8024/rtc/v1/whip/?app=live&stream=48622d43e975&secret=1F8F64FE2A7447A7)
|
||||
*/
|
||||
private String pushStreamUrl;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private Double longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private Double latitude;
|
||||
|
||||
/**
|
||||
* 高度(海拔,单位:米)
|
||||
*/
|
||||
private Double altitude;
|
||||
|
||||
/**
|
||||
* 设备IP地址
|
||||
*/
|
||||
private String deviceIp;
|
||||
}
|
||||
|
||||
@@ -87,6 +87,12 @@ public class ThreeDModelFile extends SuperEntity {
|
||||
@Schema(description = "工作空间ID")
|
||||
private String workspaceId;
|
||||
|
||||
@Schema(description = "关联设备SN")
|
||||
private String deviceSn;
|
||||
|
||||
@Schema(description = "关联设备名称")
|
||||
private String deviceName;
|
||||
|
||||
// ========== 位置调整参数 ==========
|
||||
|
||||
@Schema(description = "经度偏移(度)")
|
||||
|
||||
+6
@@ -41,6 +41,12 @@ public class ThreeDModelFileDTO {
|
||||
@Schema(description = "工作空间ID")
|
||||
private String workspaceId;
|
||||
|
||||
@Schema(description = "关联设备SN")
|
||||
private String deviceSn;
|
||||
|
||||
@Schema(description = "关联设备名称")
|
||||
private String deviceName;
|
||||
|
||||
// ========== 位置调整参数 ==========
|
||||
|
||||
@Schema(description = "经度偏移(度)", defaultValue = "0")
|
||||
|
||||
+6
@@ -56,6 +56,12 @@ public class ThreeDModelFileVO {
|
||||
@Schema(description = "关联景区名称")
|
||||
private String tourismName;
|
||||
|
||||
@Schema(description = "关联设备SN")
|
||||
private String deviceSn;
|
||||
|
||||
@Schema(description = "关联设备名称")
|
||||
private String deviceName;
|
||||
|
||||
// ========== 位置参数 ==========
|
||||
|
||||
@Schema(description = "位置配置")
|
||||
|
||||
+8
@@ -42,6 +42,14 @@ public interface IThreeDModelFileService extends ISuperService<ThreeDModelFile>
|
||||
*/
|
||||
List<ThreeDModelFileVO> getByTourismId(Long tourismId);
|
||||
|
||||
/**
|
||||
* 根据设备SN获取模型列表(用于前端加载)
|
||||
*
|
||||
* @param deviceSn 设备SN
|
||||
* @return 模型列表
|
||||
*/
|
||||
List<ThreeDModelFileVO> getByDeviceSn(String deviceSn);
|
||||
|
||||
/**
|
||||
* 获取所有可用模型列表(用于前端3D地图加载)
|
||||
*
|
||||
|
||||
+19
@@ -2,6 +2,7 @@ package com.central.device.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.central.common.feign.UserService;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.service.impl.SuperServiceImpl;
|
||||
import com.central.device.mapper.AgeDeviceMapper;
|
||||
@@ -9,6 +10,7 @@ import com.central.device.model.AgeDevice;
|
||||
import com.central.device.service.IAgeDeviceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -25,6 +27,10 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AgeDeviceServiceImpl extends SuperServiceImpl<AgeDeviceMapper, AgeDevice> implements IAgeDeviceService {
|
||||
|
||||
@Autowired
|
||||
private UserService userCenterService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
@@ -33,6 +39,19 @@ public class AgeDeviceServiceImpl extends SuperServiceImpl<AgeDeviceMapper, AgeD
|
||||
@Override
|
||||
public PageResult<AgeDevice> findList(Map<String, Object> params){
|
||||
Page<AgeDevice> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||
String anchor= MapUtils.getString(params,"tenantId");
|
||||
try {
|
||||
if (anchor == null || anchor.isEmpty()) {
|
||||
anchor = com.central.common.context.TenantQueryOverrideContext.getTenantId();
|
||||
if (anchor == null || anchor.isEmpty()) {
|
||||
anchor = com.central.common.context.LoginUserContextHolder.getCurrentTenantId();
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
log.error("获取当前登录用户租户失败");
|
||||
}
|
||||
List<String> tenantIds = userCenterService.getSonTenantIds(anchor);
|
||||
params.put("tenantIds",tenantIds);
|
||||
List<AgeDevice> list = baseMapper.findList(page, params);
|
||||
return PageResult.<AgeDevice>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||
}
|
||||
|
||||
+11
@@ -74,6 +74,14 @@ public class ThreeDModelFileServiceImpl extends SuperServiceImpl<ThreeDModelFile
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThreeDModelFileVO> getByDeviceSn(String deviceSn) {
|
||||
List<ThreeDModelFile> list = baseMapper.findByDeviceSn(deviceSn);
|
||||
return list.stream()
|
||||
.map(this::convertToVO)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThreeDModelFileVO> getAllAvailableModels() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
@@ -138,6 +146,9 @@ public class ThreeDModelFileServiceImpl extends SuperServiceImpl<ThreeDModelFile
|
||||
model.setTourismId(dto.getTourismId());
|
||||
model.setTourismName(dto.getTourismName());
|
||||
}
|
||||
// 更新关联设备(允许清空)
|
||||
model.setDeviceSn(dto.getDeviceSn());
|
||||
model.setDeviceName(dto.getDeviceName());
|
||||
|
||||
// 更新位置参数
|
||||
if (dto.getOffsetLongitude() != null) {
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
<if test="p.deviceType != null and p.deviceType != ''">
|
||||
and t.device_type = #{p.deviceType}
|
||||
</if>
|
||||
<if test="p.tenantIds != null and p.tenantIds.size > 0">
|
||||
AND t.tenant_id IN
|
||||
<foreach collection="p.tenantIds" item="tid" open="(" separator="," close=")">
|
||||
#{tid}
|
||||
</foreach>
|
||||
</if>
|
||||
order by t.id desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
<if test="p.sourceType != null and p.sourceType != ''">
|
||||
AND t.source_type = #{p.sourceType}
|
||||
</if>
|
||||
<if test="p.deviceSn != null and p.deviceSn != ''">
|
||||
AND t.device_sn = #{p.deviceSn}
|
||||
</if>
|
||||
<if test="p.deviceName != null and p.deviceName != ''">
|
||||
AND t.device_name LIKE CONCAT('%', #{p.deviceName}, '%')
|
||||
</if>
|
||||
<if test="p.startTime != null">
|
||||
AND t.create_time >= #{p.startTime}
|
||||
</if>
|
||||
|
||||
@@ -126,3 +126,20 @@ AFTER `cesium_height`;
|
||||
|
||||
|
||||
ALTER TABLE manage_device ADD COLUMN video_stream_url VARCHAR(500) COMMENT '视频流地 址(WHEP URL)';
|
||||
|
||||
-- V1.2: 添加设备绑定字段
|
||||
-- 用于将3D模型与设备关联,便于设备视图中展示对应的3D模型
|
||||
|
||||
-- 添加关联设备SN字段
|
||||
ALTER TABLE `3d_model_file`
|
||||
ADD COLUMN `device_sn` VARCHAR(64) DEFAULT NULL COMMENT '关联设备SN'
|
||||
AFTER `workspace_id`;
|
||||
|
||||
-- 添加关联设备名称字段(冗余,便于查询展示)
|
||||
ALTER TABLE `3d_model_file`
|
||||
ADD COLUMN `device_name` VARCHAR(100) DEFAULT NULL COMMENT '关联设备名称'
|
||||
AFTER `device_sn`;
|
||||
|
||||
-- 添加设备SN索引
|
||||
ALTER TABLE `3d_model_file`
|
||||
ADD INDEX `idx_device_sn` (`device_sn`);
|
||||
|
||||
@@ -1 +1,22 @@
|
||||
ALTER TABLE `manage_device` ADD COLUMN `push_stream_url` varchar(500) NULL COMMENT '设备推流地址' AFTER `video_stream_url`;
|
||||
--生产已经添加
|
||||
ALTER TABLE `manage_device` ADD COLUMN `push_stream_url` varchar(500) NULL COMMENT '设备推流地址' AFTER `video_stream_url`;
|
||||
--生产已经添加
|
||||
ALTER TABLE manage_device
|
||||
ADD COLUMN longitude DOUBLE(12,6) NULL COMMENT '经度' AFTER push_stream_url,
|
||||
ADD COLUMN latitude DOUBLE(12,6) NULL COMMENT '纬度' AFTER longitude,
|
||||
ADD COLUMN altitude DOUBLE(10,2) NULL COMMENT '高度(海拔,单位:米)' AFTER latitude;
|
||||
ADD COLUMN device_ip VARCHAR(50) NULL COMMENT '设备IP地址' AFTER altitude;
|
||||
|
||||
--生产已经添加
|
||||
ALTER TABLE `3d_model_file`
|
||||
ADD COLUMN `device_sn` VARCHAR(64) DEFAULT NULL COMMENT '关联设备SN'
|
||||
AFTER `workspace_id`;
|
||||
|
||||
ALTER TABLE `3d_model_file`
|
||||
ADD COLUMN `device_name` VARCHAR(100) DEFAULT NULL COMMENT '关联设备名称'
|
||||
AFTER `device_sn`;
|
||||
|
||||
ALTER TABLE `3d_model_file`
|
||||
ADD INDEX `idx_device_sn` (`device_sn`);
|
||||
|
||||
--
|
||||
Reference in New Issue
Block a user