feat(client): 添加设备绑定/解绑与屏幕镜像功能

新增家属端设备绑定/解绑接口,支持设备上报手机号同步,并引入 WebSocket 依赖以支持 WebRTC 屏幕镜像信令端点。
This commit is contained in:
TongTongStudio
2026-08-26 06:16:55 +08:00
parent 2eb14103a1
commit 76e239212a
10 changed files with 617 additions and 0 deletions

View File

@@ -154,6 +154,14 @@ public class DeviceOpsController {
return Result.judge(result);
}
@Operation(summary = "屏幕镜像", description = "通知设备开启屏幕镜像(由家属端 client 进行 WebRTC 实时远程观看与控制)")
@PostMapping("/mirror")
@Log(module = LogModuleEnum.DEVICE, value = ActionTypeEnum.REFRESH)
public Result<?> mirror(@RequestParam String sn) {
boolean result = deviceService.mirror(sn);
return Result.judge(result);
}
@Operation(summary = "开发者模式")
@PostMapping("/developer")
@Log(module = LogModuleEnum.DEVICE, value = ActionTypeEnum.DEVELOPER)

View File

@@ -33,6 +33,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -198,6 +199,18 @@ public class MobileController {
}
}
// 设备上报手机号仅当设备未建立绑定snMobile 为空)时同步,避免覆盖家属端手动建立的绑定
if (snOtherInfoReq.getPhoneNumber() != null && !snOtherInfoReq.getPhoneNumber().trim().isEmpty()) {
SnDeviceInfo deviceInfo = deviceService.lambdaQuery()
.eq(SnDeviceInfo::getSerialno, sn)
.one();
if (deviceInfo != null && !StringUtils.hasText(deviceInfo.getSnMobile())) {
deviceInfo.setSnMobile(snOtherInfoReq.getPhoneNumber());
deviceInfo.setUpdateTime(LocalDateTime.now());
deviceService.updateById(deviceInfo);
}
}
logger.info("其他信息上传成功, sn: {}", sn);
return Result.success();