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) {
|
||||
|
||||
Reference in New Issue
Block a user