feat(client): 新增家属端设备查询与端隔离鉴权
- 新增 ClientController,支持已绑定设备的信息、定位、应用与截图查询 - JWT 增加 clientType 标识,实现 admin/client 端鉴权隔离 - client 端支持独立配置令牌有效期,并在刷新时按端解析 TTL - 截图列表仅返回最近 20 条并规范化访问 URL 前缀
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.youlai.boot.device.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 设备简要信息视图对象(家属端"我的设备"列表使用)
|
||||
*
|
||||
* @author TTSTD
|
||||
* @since 2026/08/17
|
||||
*/
|
||||
@Schema(description = "设备简要信息")
|
||||
@Data
|
||||
public class DeviceBriefVO implements Serializable {
|
||||
|
||||
@Schema(description = "设备序列号")
|
||||
private String serialno;
|
||||
|
||||
@Schema(description = "设备名称")
|
||||
private String snName;
|
||||
|
||||
@Schema(description = "设备型号")
|
||||
private String snModel;
|
||||
|
||||
@Schema(description = "绑定手机号")
|
||||
private String snMobile;
|
||||
|
||||
@Schema(description = "状态(0-未激活 1-正常)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "激活时间")
|
||||
private LocalDateTime activateTime;
|
||||
}
|
||||
@@ -28,16 +28,30 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, SnScree
|
||||
|
||||
@Override
|
||||
public List<ScreenshotVO> listBySn(String sn) {
|
||||
// 按 upload_time 倒序仅取最近 20 张,避免截图量大时返回全量影响性能与首页加载。
|
||||
List<SnScreenshot> list = this.list(
|
||||
new LambdaQueryWrapper<SnScreenshot>()
|
||||
.eq(SnScreenshot::getSn, sn)
|
||||
.orderByDesc(SnScreenshot::getUploadTime)
|
||||
.last("LIMIT 20")
|
||||
);
|
||||
// 规范化访问前缀,避免配置值含多余斜杠导致 URL 拼接异常。
|
||||
String prefix = accessUrlPrefix;
|
||||
if (prefix == null || prefix.isEmpty()) {
|
||||
prefix = "/static";
|
||||
}
|
||||
if (!prefix.startsWith("/")) {
|
||||
prefix = "/" + prefix;
|
||||
}
|
||||
while (prefix.endsWith("/")) {
|
||||
prefix = prefix.substring(0, prefix.length() - 1);
|
||||
}
|
||||
final String base = prefix + "/screenshot/";
|
||||
return list.stream().map(entity -> {
|
||||
ScreenshotVO vo = new ScreenshotVO();
|
||||
BeanUtils.copyProperties(entity, vo);
|
||||
// 拼接可访问的静态资源 URL:/static/screenshot/{fileName}
|
||||
vo.setUrl(accessUrlPrefix + "/screenshot/" + entity.getFileName());
|
||||
vo.setUrl(base + entity.getFileName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user