Bläddra i källkod

Merge branch 'master' of http://117.50.213.128:10880/lihao16/smsb-plus

Shinohara Haruna 6 månader sedan
förälder
incheckning
429d2ceb73
22 ändrade filer med 1414 tillägg och 153 borttagningar
  1. 105 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/controller/SmsbDeviceLoginController.java
  2. 70 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/SmsbDeviceLogin.java
  3. 37 20
      smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/SmsbDeviceRunInfo.java
  4. 3 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/bo/HttpHeartbeatReq.java
  5. 41 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/bo/SmsbDeviceLoginBo.java
  6. 3 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/constants/DeviceConstants.java
  7. 87 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/vo/SmsbDeviceLoginVo.java
  8. 48 24
      smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/vo/SmsbDeviceRunInfoVo.java
  9. 19 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/mapper/SmsbDeviceLoginMapper.java
  10. 78 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/service/ISmsbDeviceLoginService.java
  11. 181 0
      smsb-modules/smsb-device/src/main/java/com/inspur/device/service/impl/SmsbDeviceLoginServiceImpl.java
  12. 41 1
      smsb-modules/smsb-device/src/main/java/com/inspur/device/service/impl/SmsbDeviceServiceImpl.java
  13. 29 0
      smsb-modules/smsb-device/src/main/resources/mapper/device/SmsbDeviceLoginMapper.xml
  14. 1 15
      smsb-modules/smsb-netty/src/main/java/com/inspur/netty/handler/DeviceRunInfoHandler.java
  15. 3 3
      smsb-modules/smsb-netty/src/main/java/com/inspur/netty/server/NettyServer.java
  16. 17 0
      smsb-modules/smsb-source/src/main/java/com/inspur/source/controller/SmsbFrontController.java
  17. 22 7
      smsb-modules/smsb-source/src/main/java/com/inspur/source/service/impl/SmsbItemPushServiceImpl.java
  18. 63 0
      smsb-plus-ui/src/api/smsb/device/device_login.ts
  19. 66 0
      smsb-plus-ui/src/api/smsb/device/device_login_type.ts
  20. 167 22
      smsb-plus-ui/src/api/smsb/device/device_run_type.ts
  21. 96 61
      smsb-plus-ui/src/views/smsb/device/index.vue
  22. 237 0
      smsb-plus-ui/src/views/smsb/deviceLogin/index.vue

+ 105 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/controller/SmsbDeviceLoginController.java

@@ -0,0 +1,105 @@
+package com.inspur.device.controller;
+
+import java.util.List;
+
+import com.inspur.device.domain.bo.SmsbDeviceLoginBo;
+import com.inspur.device.domain.vo.SmsbDeviceLoginVo;
+import com.inspur.device.service.ISmsbDeviceLoginService;
+import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.*;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.excel.utils.ExcelUtil;
+
+/**
+ * 设备登录
+ *
+ * @author Hao Li
+ * @date 2025-04-28
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/smsb/device/login")
+public class SmsbDeviceLoginController extends BaseController {
+
+    private final ISmsbDeviceLoginService smsbDeviceLoginService;
+
+    /**
+     * 查询设备登录列表
+     */
+    @SaCheckPermission("device:login:list")
+    @GetMapping("/list")
+    public TableDataInfo<SmsbDeviceLoginVo> list(SmsbDeviceLoginBo bo, PageQuery pageQuery) {
+        return smsbDeviceLoginService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出设备登录列表
+     */
+    @SaCheckPermission("device:login:export")
+    @Log(title = "设备登录", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(SmsbDeviceLoginBo bo, HttpServletResponse response) {
+        List<SmsbDeviceLoginVo> list = smsbDeviceLoginService.queryList(bo);
+        ExcelUtil.exportExcel(list, "设备登录", SmsbDeviceLoginVo.class, response);
+    }
+
+    /**
+     * 获取设备登录详细信息
+     *
+     * @param id 主键
+     */
+    @SaCheckPermission("device:login:query")
+    @GetMapping("/{id}")
+    public R<SmsbDeviceLoginVo> getInfo(@NotNull(message = "主键不能为空")
+                                        @PathVariable Long id) {
+        return R.ok(smsbDeviceLoginService.queryById(id));
+    }
+
+    /**
+     * 新增设备登录
+     */
+    @SaCheckPermission("device:deviceLogin:add")
+    @Log(title = "设备登录", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody SmsbDeviceLoginBo bo) {
+        return toAjax(smsbDeviceLoginService.insertByBo(bo));
+    }
+
+    /**
+     * 修改设备登录
+     */
+    @SaCheckPermission("device:login:edit")
+    @Log(title = "设备登录", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody SmsbDeviceLoginBo bo) {
+        return toAjax(smsbDeviceLoginService.updateByBo(bo));
+    }
+
+    /**
+     * 删除设备登录
+     *
+     * @param ids 主键串
+     */
+    @SaCheckPermission("device:login:remove")
+    @Log(title = "设备登录", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable Long[] ids) {
+        return toAjax(smsbDeviceLoginService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 70 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/SmsbDeviceLogin.java

@@ -0,0 +1,70 @@
+package com.inspur.device.domain;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+
+import java.io.Serial;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 设备登录对象 smsb_device_login
+ *
+ * @author Hao Li
+ * @date 2025-04-28
+ */
+@Data
+@TableName("smsb_device_login")
+public class SmsbDeviceLogin {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 请求标识
+     */
+    private String reqIdentifier;
+
+    /**
+     * 请求IP
+     */
+    private String reqIp;
+
+    /**
+     * 设备标识
+     */
+    private String identifier;
+
+    /**
+     * 登录结果 smsb_device_login_result
+     */
+    private Integer loginResult;
+
+    /**
+     * 创建时间
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    /**
+     * 请求参数
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    @TableField(exist = false)
+    private Map<String, Object> params = new HashMap<>();
+
+
+}

+ 37 - 20
smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/SmsbDeviceRunInfo.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
 
 import java.io.Serial;
 import java.util.Date;
@@ -14,10 +13,9 @@ import java.util.Date;
  * 设备运行信息对象 smsb_device_run_info
  *
  * @author Hao Li
- * @date 2025-02-28
+ * @date 2025-04-27
  */
 @Data
-@EqualsAndHashCode
 @TableName("smsb_device_run_info")
 public class SmsbDeviceRunInfo {
 
@@ -36,44 +34,64 @@ public class SmsbDeviceRunInfo {
     private Long deviceId;
 
     /**
-     * CPU
+     * 亮度
      */
-    private String cpuInfo;
+    private Long bright;
 
     /**
-     * 内存
+     * 音量
      */
-    private String memoryInfo;
+    private Long volume;
 
     /**
-     * 硬盘
+     * CPU使用率
      */
-    private String diskInfo;
+    private String cpuUsage;
 
     /**
-     * rom版本
+     * 外部存储 总量
      */
-    private String rom;
+    private String externalMemoryTotal;
 
     /**
-     * 系统信息
+     * 外部存储 已使用
      */
-    private String osInfo;
+    private String externalMemoryUsage;
 
     /**
-     * apk版本
+     * 外部存储 使用百分比
      */
-    private String apkVersion;
+    private String externalUsage;
 
     /**
-     * 下载速率
+     * 内存 总量
      */
-    private String download;
+    private String ramTotalOfByte;
 
     /**
-     * 运行列表
+     * 内存 已使用
      */
-    private String appList;
+    private String ramUsageOfByte;
+
+    /**
+     * 系统构建时间
+     */
+    private String systemBuildDate;
+
+    /**
+     * 系统构建版本
+     */
+    private String systemBuildVersion;
+
+    /**
+     * 版本code
+     */
+    private String versionCode;
+
+    /**
+     * 版本名称
+     */
+    private String versionName;
 
     /**
      * 创建时间
@@ -82,5 +100,4 @@ public class SmsbDeviceRunInfo {
     private Date createTime;
 
     private String tenantId;
-
 }

+ 3 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/bo/HttpHeartbeatReq.java

@@ -13,6 +13,9 @@ public class HttpHeartbeatReq {
     /** 设备标识 */
     private String identifier;
 
+    /** 设备IP */
+    private String deviceIp;
+
     /** 亮度 */
     private Integer bright;
 

+ 41 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/bo/SmsbDeviceLoginBo.java

@@ -0,0 +1,41 @@
+package com.inspur.device.domain.bo;
+
+import com.inspur.device.domain.SmsbDeviceLogin;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+
+/**
+ * 设备登录业务对象 smsb_device_login
+ *
+ * @author Hao Li
+ * @date 2025-04-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = SmsbDeviceLogin.class, reverseConvertGenerate = false)
+public class SmsbDeviceLoginBo extends BaseEntity {
+
+    private Long id;
+
+    /**
+     * 请求标识
+     */
+    private String reqIdentifier;
+
+    /**
+     * 请求IP
+     */
+    private String reqIp;
+
+    /**
+     * 设备标识
+     */
+    private String identifier;
+
+    /**
+     * 登录结果smsb_device_login_result
+     */
+    private Long loginResult;
+}

+ 3 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/constants/DeviceConstants.java

@@ -44,5 +44,8 @@ public class DeviceConstants {
     /** 设备http最后一次心跳时间 */
     public static final String REDIS_DEVICE_HEARTBEAT_HTTP_KEY = "global:device:heartbeat:http:";
 
+    /** 前端设备鉴权key */
+    public static final String REDIS_DEVICE_AUTH_KEY = "global:device:auth:key:";
+
 
 }

+ 87 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/vo/SmsbDeviceLoginVo.java

@@ -0,0 +1,87 @@
+package com.inspur.device.domain.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.inspur.device.domain.SmsbDeviceLogin;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.excel.convert.ExcelDictConvert;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 设备登录视图对象 smsb_device_login
+ *
+ * @author Hao Li
+ * @date 2025-04-28
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = SmsbDeviceLogin.class)
+public class SmsbDeviceLoginVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @ExcelProperty(value = "主键ID")
+    private Long id;
+
+    /**
+     * 请求标识
+     */
+    @ExcelProperty(value = "请求标识")
+    private String reqIdentifier;
+
+    /**
+     * 请求IP
+     */
+    @ExcelProperty(value = "请求IP")
+    private String reqIp;
+
+    /**
+     * 设备标识
+     */
+    @ExcelProperty(value = "设备标识")
+    private String identifier;
+
+    /**
+     * 登录结果smsb_device_login_result
+     */
+    @ExcelProperty(value = "登录结果smsb_device_login_result", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "smsb_device_login_result")
+    private Long loginResult;
+
+    /**
+     * 登录时间
+     */
+    @ExcelProperty(value = "登录时间")
+    private Date createTime;
+
+    /**
+     * 设备名称
+     */
+    @ExcelProperty(value = "设备名称")
+    private String deviceName;
+
+
+    /**
+     * sn号
+     */
+    @ExcelProperty(value = "sn号")
+    private String serialNumber;
+
+    /**
+     * mac号
+     */
+    @ExcelProperty(value = "mac号")
+    private String mac;
+
+
+}

+ 48 - 24
smsb-modules/smsb-device/src/main/java/com/inspur/device/domain/vo/SmsbDeviceRunInfoVo.java

@@ -40,52 +40,76 @@ public class SmsbDeviceRunInfoVo implements Serializable {
     private Long deviceId;
 
     /**
-     * CPU
+     * 亮度
      */
-    @ExcelProperty(value = "CPU")
-    private String cpuInfo;
+    @ExcelProperty(value = "亮度")
+    private Long bright;
 
     /**
-     * 内存
+     * 音量
      */
-    @ExcelProperty(value = "内存")
-    private String memoryInfo;
+    @ExcelProperty(value = "音量")
+    private Long volume;
 
     /**
-     * 硬盘
+     * CPU使用率
      */
-    @ExcelProperty(value = "硬盘")
-    private String diskInfo;
+    @ExcelProperty(value = "CPU使用率")
+    private String cpuUsage;
 
     /**
-     * rom版本
+     * 外部存储 总量
      */
-    @ExcelProperty(value = "rom版本")
-    private String rom;
+    @ExcelProperty(value = "外部存储 总量")
+    private String externalMemoryTotal;
 
     /**
-     * 系统信息
+     * 外部存储 已使用
      */
-    @ExcelProperty(value = "系统信息")
-    private String osInfo;
+    @ExcelProperty(value = "外部存储 已使用")
+    private String externalMemoryUsage;
 
     /**
-     * apk版本
+     * 外部存储 使用百分比
      */
-    @ExcelProperty(value = "apk版本")
-    private String apkVersion;
+    @ExcelProperty(value = "外部存储 使用百分比")
+    private String externalUsage;
 
     /**
-     * 下载速率
+     * 内存 总量
      */
-    @ExcelProperty(value = "下载速率")
-    private String download;
+    @ExcelProperty(value = "内存 总量")
+    private String ramTotalOfByte;
 
     /**
-     * 运行列表
+     * 内存 已使用
      */
-    @ExcelProperty(value = "运行列表")
-    private String appList;
+    @ExcelProperty(value = "内存 已使用")
+    private String ramUsageOfByte;
+
+    /**
+     * 系统构建时间
+     */
+    @ExcelProperty(value = "系统构建时间")
+    private String systemBuildDate;
+
+    /**
+     * 系统构建版本
+     */
+    @ExcelProperty(value = "系统构建版本")
+    private String systemBuildVersion;
+
+    /**
+     * 版本code
+     */
+    @ExcelProperty(value = "版本code")
+    private String versionCode;
+
+    /**
+     * 版本名称
+     */
+    @ExcelProperty(value = "版本名称")
+    private String versionName;
 
     /**
      * 创建时间

+ 19 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/mapper/SmsbDeviceLoginMapper.java

@@ -0,0 +1,19 @@
+package com.inspur.device.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.inspur.device.domain.SmsbDeviceLogin;
+import com.inspur.device.domain.bo.SmsbDeviceLoginBo;
+import com.inspur.device.domain.vo.SmsbDeviceLoginVo;
+import org.apache.ibatis.annotations.Param;
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+
+/**
+ * 设备登录Mapper接口
+ *
+ * @author Hao Li
+ * @date 2025-04-28
+ */
+public interface SmsbDeviceLoginMapper extends BaseMapperPlus<SmsbDeviceLogin, SmsbDeviceLoginVo> {
+
+    Page<SmsbDeviceLoginVo> selectPageVoList(@Param("page") Page<SmsbDeviceLogin> page, @Param("bo") SmsbDeviceLoginBo bo);
+}

+ 78 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/service/ISmsbDeviceLoginService.java

@@ -0,0 +1,78 @@
+package com.inspur.device.service;
+
+import com.inspur.device.domain.bo.HttpHeartbeatReq;
+import com.inspur.device.domain.bo.SmsbDeviceLoginBo;
+import com.inspur.device.domain.vo.HttpHeartbeatRspVo;
+import com.inspur.device.domain.vo.SmsbDeviceLoginVo;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 设备登录Service接口
+ *
+ * @author Hao Li
+ * @date 2025-04-28
+ */
+public interface ISmsbDeviceLoginService {
+
+    /**
+     * 查询设备登录
+     *
+     * @param id 主键
+     * @return 设备登录
+     */
+    SmsbDeviceLoginVo queryById(Long id);
+
+    /**
+     * 分页查询设备登录列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 设备登录分页列表
+     */
+    TableDataInfo<SmsbDeviceLoginVo> queryPageList(SmsbDeviceLoginBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询符合条件的设备登录列表
+     *
+     * @param bo 查询条件
+     * @return 设备登录列表
+     */
+    List<SmsbDeviceLoginVo> queryList(SmsbDeviceLoginBo bo);
+
+    /**
+     * 新增设备登录
+     *
+     * @param bo 设备登录
+     * @return 是否新增成功
+     */
+    Boolean insertByBo(SmsbDeviceLoginBo bo);
+
+    /**
+     * 修改设备登录
+     *
+     * @param bo 设备登录
+     * @return 是否修改成功
+     */
+    Boolean updateByBo(SmsbDeviceLoginBo bo);
+
+    /**
+     * 校验并批量删除设备登录信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    /**
+     * 前端设备登录
+     * @param requestParam
+     * @return
+     */
+    R<HttpHeartbeatRspVo> deviceLogin(HttpHeartbeatReq requestParam);
+}

+ 181 - 0
smsb-modules/smsb-device/src/main/java/com/inspur/device/service/impl/SmsbDeviceLoginServiceImpl.java

@@ -0,0 +1,181 @@
+package com.inspur.device.service.impl;
+
+import cn.hutool.json.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.inspur.device.domain.SmsbDeviceLogin;
+import com.inspur.device.domain.bo.HttpHeartbeatReq;
+import com.inspur.device.domain.bo.SmsbDeviceLoginBo;
+import com.inspur.device.domain.constants.DeviceConstants;
+import com.inspur.device.domain.vo.HttpHeartbeatRspVo;
+import com.inspur.device.domain.vo.SmsbDeviceLoginVo;
+import com.inspur.device.domain.vo.SmsbDeviceVo;
+import com.inspur.device.mapper.SmsbDeviceLoginMapper;
+import com.inspur.device.service.ISmsbDeviceLoginService;
+import com.inspur.device.service.ISmsbDeviceService;
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.redis.utils.RedisUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * 设备登录Service业务层处理
+ *
+ * @author Hao Li
+ * @date 2025-04-28
+ */
+@RequiredArgsConstructor
+@Service
+public class SmsbDeviceLoginServiceImpl implements ISmsbDeviceLoginService {
+
+    private final SmsbDeviceLoginMapper baseMapper;
+
+    private final ISmsbDeviceService smsbDeviceService;
+
+    /**
+     * 查询设备登录
+     *
+     * @param id 主键
+     * @return 设备登录
+     */
+    @Override
+    public SmsbDeviceLoginVo queryById(Long id) {
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 分页查询设备登录列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 设备登录分页列表
+     */
+    @Override
+    public TableDataInfo<SmsbDeviceLoginVo> queryPageList(SmsbDeviceLoginBo bo, PageQuery pageQuery) {
+        // LambdaQueryWrapper<SmsbDeviceLogin> lqw = buildQueryWrapper(bo);
+
+        Page<SmsbDeviceLoginVo> result = baseMapper.selectPageVoList(pageQuery.build(), bo);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询符合条件的设备登录列表
+     *
+     * @param bo 查询条件
+     * @return 设备登录列表
+     */
+    @Override
+    public List<SmsbDeviceLoginVo> queryList(SmsbDeviceLoginBo bo) {
+        LambdaQueryWrapper<SmsbDeviceLogin> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<SmsbDeviceLogin> buildQueryWrapper(SmsbDeviceLoginBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<SmsbDeviceLogin> lqw = Wrappers.lambdaQuery();
+        lqw.eq(StringUtils.isNotBlank(bo.getReqIdentifier()), SmsbDeviceLogin::getReqIdentifier, bo.getReqIdentifier());
+        lqw.eq(StringUtils.isNotBlank(bo.getReqIp()), SmsbDeviceLogin::getReqIp, bo.getReqIp());
+        lqw.eq(StringUtils.isNotBlank(bo.getIdentifier()), SmsbDeviceLogin::getIdentifier, bo.getIdentifier());
+        lqw.eq(bo.getLoginResult() != null, SmsbDeviceLogin::getLoginResult, bo.getLoginResult());
+        return lqw;
+    }
+
+    /**
+     * 新增设备登录
+     *
+     * @param bo 设备登录
+     * @return 是否新增成功
+     */
+    @Override
+    public Boolean insertByBo(SmsbDeviceLoginBo bo) {
+        SmsbDeviceLogin add = MapstructUtils.convert(bo, SmsbDeviceLogin.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改设备登录
+     *
+     * @param bo 设备登录
+     * @return 是否修改成功
+     */
+    @Override
+    public Boolean updateByBo(SmsbDeviceLoginBo bo) {
+        SmsbDeviceLogin update = MapstructUtils.convert(bo, SmsbDeviceLogin.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(SmsbDeviceLogin entity) {
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 校验并批量删除设备登录信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if (isValid) {
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+
+    @Override
+    public R<HttpHeartbeatRspVo> deviceLogin(HttpHeartbeatReq requestParam) {
+        HttpHeartbeatRspVo result = new HttpHeartbeatRspVo();
+        JSONObject resultMessage = new JSONObject();
+
+        SmsbDeviceLogin add = new SmsbDeviceLogin();
+
+        String reqIdentifier = requestParam.getIdentifier();
+        String reqIp = requestParam.getDeviceIp();
+        add.setReqIdentifier(reqIdentifier);
+        add.setReqIp(reqIp);
+
+        // 1 根据reqIdentifier 查询是否是合法设备
+        SmsbDeviceVo smsbDeviceVo = smsbDeviceService.getDeviceByIdentifier(reqIdentifier);
+        // 非法设备
+        if (null == smsbDeviceVo) {
+            add.setLoginResult(0);
+            baseMapper.insert(add);
+            resultMessage.putOpt("code", "0");
+            resultMessage.putOpt("data", "非法设备");
+            result.setMessage(resultMessage.toString());
+            return R.ok(result);
+        }
+        // 合法设备
+        add.setLoginResult(1);
+        add.setIdentifier(reqIdentifier);
+        baseMapper.insert(add);
+        // 2 数据库缓存auth key
+        String authKey = UUID.randomUUID().toString().replace("-","");
+        RedisUtils.setCacheObject(DeviceConstants.REDIS_DEVICE_AUTH_KEY + reqIdentifier, authKey);
+        // 3 接口返回 auth key
+        resultMessage.putOpt("code", "1");
+        resultMessage.putOpt("data", authKey);
+        result.setMessage(resultMessage.toString());
+        return R.ok(result);
+    }
+}

+ 41 - 1
smsb-modules/smsb-device/src/main/java/com/inspur/device/service/impl/SmsbDeviceServiceImpl.java

@@ -46,6 +46,7 @@ import java.nio.charset.StandardCharsets;
 import java.time.Duration;
 import java.util.Collection;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 /**
@@ -175,7 +176,8 @@ public class SmsbDeviceServiceImpl implements ISmsbDeviceService {
         validEntityBeforeSave(add);
 
         // identifier
-        String identifier = getHashString(add.getSerialNumber());
+        // String identifier = getHashString(add.getSerialNumber());
+        String identifier = encryptMac(add.getMac().toLowerCase(Locale.ROOT));
         add.setIdentifier(identifier);
 
         boolean flag = baseMapper.insert(add) > 0;
@@ -186,6 +188,42 @@ public class SmsbDeviceServiceImpl implements ISmsbDeviceService {
         return flag;
     }
 
+    private String encryptMac(String mac) {
+        // Step 1: 去除冒号
+        String step1 = mac.replaceAll(":", "");
+
+        // Step 2: 每位转换为双位数十进制
+        StringBuilder step2 = new StringBuilder();
+        for (char c : step1.toCharArray()) {
+            int value = Character.digit(c, 16);
+            step2.append(String.format("%02d", value));
+        }
+
+        // Step 3: 每两位换位
+        String step2Str = step2.toString();
+        StringBuilder step3 = new StringBuilder();
+        for (int i = 0; i < step2Str.length(); i += 2) {
+            if (i + 1 < step2Str.length()) {
+                step3.append(step2Str.charAt(i + 1));
+                step3.append(step2Str.charAt(i));
+            } else {
+                step3.append(step2Str.charAt(i));
+            }
+        }
+
+        // Step 4: 前两位和后两位颠倒
+        String step3Str = step3.toString();
+        if (step3Str.length() < 2) {
+            return step3Str;
+        }
+        String firstTwo = step3Str.substring(0, 2);
+        String lastTwo = step3Str.substring(step3Str.length() - 2);
+        String middle = step3Str.length() > 4 ? step3Str.substring(2, step3Str.length() - 2) : "";
+
+        return lastTwo + middle + firstTwo;
+
+    }
+
     /**
      * 修改设备
      *
@@ -196,6 +234,8 @@ public class SmsbDeviceServiceImpl implements ISmsbDeviceService {
     @CacheEvict(cacheNames = "global:msr:device:identifier", allEntries = true)
     public Boolean updateByBo(SmsbDeviceBo bo) {
         SmsbDevice update = MapstructUtils.convert(bo, SmsbDevice.class);
+        String identifier = encryptMac(update.getMac().toLowerCase(Locale.ROOT));
+        update.setIdentifier(identifier);
         // validEntityBeforeSave(update);
         refreshCacheById();
         return baseMapper.updateById(update) > 0;

+ 29 - 0
smsb-modules/smsb-device/src/main/resources/mapper/device/SmsbDeviceLoginMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.inspur.device.mapper.SmsbDeviceLoginMapper">
+
+    <select id="selectPageVoList" resultType="com.inspur.device.domain.vo.SmsbDeviceLoginVo" parameterType="com.inspur.device.domain.bo.SmsbDeviceLoginBo">
+        SELECT
+            sdl.*,
+            sd.NAME AS deviceName,
+            sd.serial_number,
+            sd.mac
+        FROM
+            smsb_device_login sdl
+        LEFT JOIN smsb_device sd ON sdl.identifier = sd.identifier
+        WHERE 1=1
+        <if test="bo.identifier != null and bo.identifier != ''">
+            AND sdl.identifier = #{bo.identifier}
+        </if>
+        <if test="bo.reqIp != null and bo.reqIp != ''">
+            AND sdl.reqIp = #{bo.reqIp}
+        </if>
+        <if test="bo.loginResult != null">
+            AND sdl.loginResult = #{bo.loginResult}
+        </if>
+        ORDER BY sdl.create_time DESC
+    </select>
+
+</mapper>

+ 1 - 15
smsb-modules/smsb-netty/src/main/java/com/inspur/netty/handler/DeviceRunInfoHandler.java

@@ -44,21 +44,7 @@ public class DeviceRunInfoHandler extends ChannelInboundHandlerAdapter {
     }
 
     private void buildSmsbDeviceRunInfo(SmsbDeviceRunInfo smsbDeviceRunInfo, String[] messageArray, SmsbDeviceVo smsbDeviceVo) {
-        // {identifier}/device/run/info/{cpu}/{memory}/{disk}/{os}/{rom}/{apk}
-        String cpuInfo = messageArray[4];
-        String memoryInfo = messageArray[5];
-        String diskInfo = messageArray[6];
-        String osInfo = messageArray[7];
-        String romInfo = messageArray[8];
-        String apkInfo = messageArray[9];
-        smsbDeviceRunInfo.setCpuInfo(cpuInfo);
-        smsbDeviceRunInfo.setMemoryInfo(memoryInfo);
-        smsbDeviceRunInfo.setDiskInfo(diskInfo);
-        smsbDeviceRunInfo.setOsInfo(osInfo);
-        smsbDeviceRunInfo.setRom(romInfo);
-        smsbDeviceRunInfo.setApkVersion(apkInfo);
-        smsbDeviceRunInfo.setDeviceId(smsbDeviceVo.getId());
-        smsbDeviceRunInfo.setTenantId(smsbDeviceVo.getTenantId());
+
     }
 
 }

+ 3 - 3
smsb-modules/smsb-netty/src/main/java/com/inspur/netty/server/NettyServer.java

@@ -57,9 +57,9 @@ public class NettyServer {
                             channel.pipeline().addLast(new AuthServerHandler());
                             channel.pipeline().addLast(new ConnectServerHandler());
                             channel.pipeline().addLast(new HeartServerHandler());
-                            channel.pipeline().addLast(new OTACheckReplayHandler());
-                            channel.pipeline().addLast(new DeviceRunInfoHandler());
-                            channel.pipeline().addLast(new ContentDownloadStatusHandler());
+                            // channel.pipeline().addLast(new OTACheckReplayHandler());
+                            // channel.pipeline().addLast(new DeviceRunInfoHandler());
+                            // channel.pipeline().addLast(new ContentDownloadStatusHandler());
                             channel.pipeline().addLast(new SourcePlayRecordHandler());
                         }
                     });

+ 17 - 0
smsb-modules/smsb-source/src/main/java/com/inspur/source/controller/SmsbFrontController.java

@@ -4,6 +4,8 @@ import cn.dev33.satoken.annotation.SaIgnore;
 import com.inspur.device.domain.bo.HttpHeartbeatReq;
 import com.inspur.device.domain.vo.HttpHeartbeatRspVo;
 import com.inspur.device.domain.vo.SmsbOtaRecordVo;
+import com.inspur.device.service.ISmsbDeviceLoginService;
+import com.inspur.device.service.ISmsbDeviceRunInfoService;
 import com.inspur.device.service.ISmsbDeviceService;
 import com.inspur.device.service.ISmsbOtaRecordService;
 import com.inspur.source.domain.vo.FrontPushInfoVo;
@@ -35,6 +37,9 @@ public class SmsbFrontController {
     @Autowired
     private ISmsbDeviceService smsbDeviceService;
 
+    @Autowired
+    private ISmsbDeviceLoginService smsbDeviceLoginService;
+
     /**
      * 根据设备identifier 获取该设备最新内容下发记录
      *
@@ -95,4 +100,16 @@ public class SmsbFrontController {
         return smsbDeviceService.heartbeat(requestParam);
     }
 
+
+    /**
+     * 前端设备登录接口
+     *
+     * @param requestParam 主键
+     */
+    @SaIgnore
+    @PostMapping("/login")
+    public R<HttpHeartbeatRspVo> deviceLogin(@RequestBody HttpHeartbeatReq requestParam) {
+        return smsbDeviceLoginService.deviceLogin(requestParam);
+    }
+
 }

+ 22 - 7
smsb-modules/smsb-source/src/main/java/com/inspur/source/service/impl/SmsbItemPushServiceImpl.java

@@ -60,6 +60,8 @@ import org.flowable.task.api.TaskQuery;
 import org.flowable.task.service.impl.persistence.entity.TaskEntity;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.context.event.EventListener;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -292,9 +294,12 @@ public class SmsbItemPushServiceImpl implements ISmsbItemPushService {
     private void pushNettyMsg(List<String> deviceIds, Long pushId) {
         List<SmsbDevice> smsbDevices = smsbDeviceMapper.selectByIds(deviceIds);
         for (SmsbDevice smsbDevice : smsbDevices) {
+            // 1 发送长连接消息
             String nettyMessage = PushMessageType.CONTENT_UPDATE.getValue() + "/" + pushId;
             boolean pushResult = PushMsgUtil.sendV2(smsbDevice.getIdentifier(), nettyMessage);
             log.info("push content update identifier: {}, result:{}", smsbDevice.getIdentifier(), pushResult);
+            // 2 redis 缓存预加载
+            cachePushInfo(smsbDevice.getIdentifier());
         }
     }
 
@@ -407,20 +412,31 @@ public class SmsbItemPushServiceImpl implements ISmsbItemPushService {
 
     @Override
     public R<FrontPushInfoVo> getItemPushInfo(String identifier) {
-        FrontPushInfoVo result = new FrontPushInfoVo();
         if (StringUtils.isEmpty(identifier)) {
             return R.fail(HttpApiResult.PARAM_IS_NULL.getCode(), HttpApiResult.PARAM_IS_NULL.getInfo());
         }
+        FrontPushInfoVo result = getItemPushInfoByCache(identifier);
+        return R.ok(result);
+    }
+
+    @Cacheable(cacheNames = "global:msr:device:identifier", key = "#identifier")
+    public FrontPushInfoVo getItemPushInfoByCache(String identifier) {
+        return generatePushInfo(identifier);
+    }
+
+    @CachePut(cacheNames = "global:msr:device:identifier", key = "#identifier")
+    public FrontPushInfoVo cachePushInfo(String identifier) {
+        return generatePushInfo(identifier);
+    }
+
+    public FrontPushInfoVo generatePushInfo(String identifier) {
+        FrontPushInfoVo result = new FrontPushInfoVo();
         SmsbDeviceVo deviceVo = smsbDeviceService.getDeviceByIdentifier(identifier);
-        if (deviceVo == null) {
-            return R.fail(HttpApiResult.DEVICE_NOT_EXIST.getCode(), HttpApiResult.DEVICE_NOT_EXIST.getInfo());
-        }
         // 根据设备ID查询当前设备最新的内容下发
         Long deviceId = deviceVo.getId();
         result.setDeviceId(deviceId);
         result.setWidth(deviceVo.getWidth());
         result.setHeight(deviceVo.getHeight());
-
         // 查询不同等级的节目发布 100垫片 200常规 300紧急
         List<SmsbItemPushVo> smsbItemPushVoLevel1 = baseMapper.selectFrontOnePushByDeviceId(deviceId, 100);
         buildPushItemInfo(result, smsbItemPushVoLevel1);
@@ -428,8 +444,7 @@ public class SmsbItemPushServiceImpl implements ISmsbItemPushService {
         buildPushItemInfo(result, smsbItemPushVoLevel2);
         List<SmsbItemPushVo> smsbItemPushVoLevel3 = baseMapper.selectFrontOnePushByDeviceId(deviceId, 300);
         buildPushItemInfo(result, smsbItemPushVoLevel3);
-
-        return R.ok(result);
+        return result;
     }
 
     private void buildPushItemInfo(FrontPushInfoVo result, List<SmsbItemPushVo> smsbItemPushVoList) {

+ 63 - 0
smsb-plus-ui/src/api/smsb/device/device_login.ts

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+import { AxiosPromise } from 'axios';
+import { DeviceLoginVO, DeviceLoginForm, DeviceLoginQuery } from '@/api/device/deviceLogin/types';
+
+/**
+ * 查询设备登录列表
+ * @param query
+ * @returns {*}
+ */
+
+export const listDeviceLogin = (query?: DeviceLoginQuery): AxiosPromise<DeviceLoginVO[]> => {
+  return request({
+    url: '/smsb/device/login/list',
+    method: 'get',
+    params: query
+  });
+};
+
+/**
+ * 查询设备登录详细
+ * @param id
+ */
+export const getDeviceLogin = (id: string | number): AxiosPromise<DeviceLoginVO> => {
+  return request({
+    url: '/smsb/device/login/' + id,
+    method: 'get'
+  });
+};
+
+/**
+ * 新增设备登录
+ * @param data
+ */
+export const addDeviceLogin = (data: DeviceLoginForm) => {
+  return request({
+    url: '/smsb/device/login',
+    method: 'post',
+    data: data
+  });
+};
+
+/**
+ * 修改设备登录
+ * @param data
+ */
+export const updateDeviceLogin = (data: DeviceLoginForm) => {
+  return request({
+    url: '/smsb/device/login',
+    method: 'put',
+    data: data
+  });
+};
+
+/**
+ * 删除设备登录
+ * @param id
+ */
+export const delDeviceLogin = (id: string | number | Array<string | number>) => {
+  return request({
+    url: '/smsb/device/login/' + id,
+    method: 'delete'
+  });
+};

+ 66 - 0
smsb-plus-ui/src/api/smsb/device/device_login_type.ts

@@ -0,0 +1,66 @@
+export interface DeviceLoginVO {
+  /**
+   * 主键ID
+   */
+  id: string | number;
+
+  /**
+   * 请求标识
+   */
+  reqIdentifier: string | number;
+
+  /**
+   * 请求IP
+   */
+  reqIp: string;
+
+  /**
+   * 设备标识
+   */
+  identifier: string | number;
+
+  /**
+   * 登录结果smsb_device_login_result
+   */
+  loginResult: number;
+
+  /**
+   * 登录时间
+   */
+  createTime: string;
+
+}
+
+export interface DeviceLoginForm extends BaseEntity {
+}
+
+export interface DeviceLoginQuery extends PageQuery {
+
+  /**
+   * 请求标识
+   */
+  reqIdentifier?: string | number;
+
+  /**
+   * 请求IP
+   */
+  reqIp?: string;
+
+  /**
+   * 设备标识
+   */
+  identifier?: string | number;
+
+  /**
+   * 登录结果smsb_device_login_result
+   */
+  loginResult?: number;
+
+  /**
+   * 日期范围参数
+   */
+  params?: any;
+}
+
+
+

+ 167 - 22
smsb-plus-ui/src/api/smsb/device/device_run_type.ts

@@ -1,7 +1,4 @@
-import { DeviceVO } from '@/api/smsb/device/device_type';
-
 export interface DeviceRunInfoVO {
-  deviceBase: DeviceVO;
   /**
    * 主键ID
    */
@@ -13,59 +10,207 @@ export interface DeviceRunInfoVO {
   deviceId: string | number;
 
   /**
-   * CPU
+   * 亮度
+   */
+  bright: number;
+
+  /**
+   * 音量
+   */
+  volume: number;
+
+  /**
+   * CPU使用率
+   */
+  cpuUsage: string;
+
+  /**
+   * 外部存储 总量
    */
-  cpuInfo: number;
+  externalMemoryTotal: string;
 
   /**
-   * 内存
+   * 外部存储 已使用
    */
-  memoryInfo: number;
+  externalMemoryUsage: string;
 
   /**
-   * 硬盘
+   * 外部存储 使用百分比
    */
-  diskInfo: number;
+  externalUsage: string;
 
   /**
-   * rom版本
+   * 内存 总量
    */
-  rom: string;
+  ramTotalOfByte: string;
 
   /**
-   * 系统信息
+   * 内存 已使用
    */
-  osInfo: string;
+  ramUsageOfByte: string;
 
   /**
-   * apk版本
+   * 系统构建时间
    */
-  apkVersion: string;
+  systemBuildDate: string;
 
   /**
-   * 下载速率
+   * 系统构建版本
    */
-  download: string;
+  systemBuildVersion: string;
 
   /**
-   * 运行列表
+   * 版本code
    */
-  appList: string;
+  versionCode: string;
 
   /**
-   * 创建时间
+   * 版本名称
    */
-  createTime: string;
+  versionName: string;
+
 }
 
-export interface DeviceRunInfoForm extends BaseEntity {}
+export interface DeviceRunInfoForm extends BaseEntity {
+  /**
+   * 主键ID
+   */
+  id?: string | number;
+
+  /**
+   * 设备ID
+   */
+  deviceId?: string | number;
+
+  /**
+   * 亮度
+   */
+  bright?: number;
+
+  /**
+   * 音量
+   */
+  volume?: number;
+
+  /**
+   * CPU使用率
+   */
+  cpuUsage?: string;
+
+  /**
+   * 外部存储 总量
+   */
+  externalMemoryTotal?: string;
+
+  /**
+   * 外部存储 已使用
+   */
+  externalMemoryUsage?: string;
+
+  /**
+   * 外部存储 使用百分比
+   */
+  externalUsage?: string;
+
+  /**
+   * 内存 总量
+   */
+  ramTotalOfByte?: string;
+
+  /**
+   * 内存 已使用
+   */
+  ramUsageOfByte?: string;
+
+  /**
+   * 系统构建时间
+   */
+  systemBuildDate?: string;
+
+  /**
+   * 系统构建版本
+   */
+  systemBuildVersion?: string;
+
+  /**
+   * 版本code
+   */
+  versionCode?: string;
+
+  /**
+   * 版本名称
+   */
+  versionName?: string;
+
+}
 
 export interface DeviceRunInfoQuery extends PageQuery {
+
   /**
    * 设备ID
    */
   deviceId?: string | number;
 
+  /**
+   * 亮度
+   */
+  bright?: number;
+
+  /**
+   * 音量
+   */
+  volume?: number;
+
+  /**
+   * CPU使用率
+   */
+  cpuUsage?: string;
+
+  /**
+   * 外部存储 总量
+   */
+  externalMemoryTotal?: string;
+
+  /**
+   * 外部存储 已使用
+   */
+  externalMemoryUsage?: string;
+
+  /**
+   * 外部存储 使用百分比
+   */
+  externalUsage?: string;
+
+  /**
+   * 内存 总量
+   */
+  ramTotalOfByte?: string;
+
+  /**
+   * 内存 已使用
+   */
+  ramUsageOfByte?: string;
+
+  /**
+   * 系统构建时间
+   */
+  systemBuildDate?: string;
+
+  /**
+   * 系统构建版本
+   */
+  systemBuildVersion?: string;
+
+  /**
+   * 版本code
+   */
+  versionCode?: string;
+
+  /**
+   * 版本名称
+   */
+  versionName?: string;
+
   /**
    * 日期范围参数
    */

+ 96 - 61
smsb-plus-ui/src/views/smsb/device/index.vue

@@ -195,45 +195,76 @@
       </template>
     </el-dialog>
     <!--设备详情弹窗-->
-    <el-dialog v-model="viewDialog.visible" :title="viewDialog.title" width="1000px" append-to-body>
-      <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClickTab">
-        <el-tab-pane label="状态检测" name="info">
+    <el-dialog v-model="viewDialog.visible" :title="viewDialog.title" width="1000px" style="height: 800px"
+               append-to-body>
+      <el-tabs v-model="activeName" style="height: 600px" @tab-click="handleClickTab">
+        <el-tab-pane label="设备详情" name="info">
           <div>
-            <div style="display: flex; justify-content: space-around; align-items: center">
-              <div style="text-align: center">
-                <div style="position: relative">
-                  CPU :
-                  <el-progress type="circle" :percentage="deviceRunInfo.cpuInfo"></el-progress>
-                  <div style="position: absolute; top: -30px; left: 50%; transform: translateX(-50%)">{{ deviceRunInfo.cpuInfo }}%</div>
-                </div>
-              </div>
-              <div style="text-align: center">
-                <div style="position: relative">
-                  内存 :
-                  <el-progress type="circle" :percentage="deviceRunInfo.memoryInfo"></el-progress>
-                  <div style="position: absolute; top: -30px; left: 50%; transform: translateX(-50%)">{{ deviceRunInfo.memoryInfo }}%</div>
-                </div>
-              </div>
-              <div style="text-align: center">
-                <div style="position: relative">
-                  硬盘 :
-                  <el-progress type="circle" :percentage="deviceRunInfo.diskInfo"></el-progress>
-                  <div style="position: absolute; top: -30px; left: 50%; transform: translateX(-50%)">{{ deviceRunInfo.diskInfo }}%</div>
-                </div>
-              </div>
-            </div>
-            <div>ROM : {{ deviceRunInfo.rom }}</div>
-            <div>系统信息 : {{ deviceRunInfo.osInfo }}</div>
-            <div>APK版本 : {{ deviceRunInfo.apkVersion }}</div>
+            <span>设备名称:{{ deviceRunInfo.deviceBase.name }}</span>
+            <span style="margin-left: 50px">SN:{{ deviceRunInfo.deviceBase.serialNumber }}</span>
+            <span style="margin-left: 50px">MAC:{{ deviceRunInfo.deviceBase.mac }}</span>
+            <br/>
           </div>
+          <div style="margin-top: 20px">
+            <span>分辨率:{{ deviceRunInfo.deviceBase.width }}*{{ deviceRunInfo.deviceBase.height }}</span>
+            <span style="margin-left: 50px">加密标识:{{ deviceRunInfo.deviceBase.identifier }}</span>
+          </div>
+          <div style="margin-top: 20px">
+            <span>最后一次上线:{{ deviceRunInfo.deviceBase.lastOnline }}</span>
+            <span style="margin-left: 50px">上次离线:{{ deviceRunInfo.deviceBase.offlineTime }}</span>
+            <span style="margin-left: 50px">创建时间:{{ deviceRunInfo.deviceBase.createTime }}</span>
+          </div>
+          <!-- 音量 -->
+          <div style="margin-top: 20px">
+
+          </div>
+          <!-- 亮度 -->
+          <div style="margin-top: 20px; display: flex; align-items: center;">
+            亮度:
+            <el-progress :show-text="false" :stroke-width="26" :percentage="deviceRunInfo.bright"
+                         style="margin-left: 10px;"/>
+          </div>
+          <!--          <div>
+                      <div style="display: flex; justify-content: space-around; align-items: center">
+                        <div style="text-align: center">
+                          <div style="position: relative">
+                            CPU :
+                            <el-progress type="circle" :percentage="deviceRunInfo.cpuUsage"></el-progress>
+                            <div style="position: absolute; top: -30px; left: 50%; transform: translateX(-50%)">
+                              {{ deviceRunInfo.cpuUsage }}%
+                            </div>
+                          </div>
+                        </div>
+                        <div style="text-align: center">
+                          <div style="position: relative">
+                            内存 :
+                            <el-progress type="circle" :percentage="deviceRunInfo.ramUsageOfByte"></el-progress>
+                            <div style="position: absolute; top: -30px; left: 50%; transform: translateX(-50%)">
+                              {{ deviceRunInfo.ramUsageOfByte }}%
+                            </div>
+                          </div>
+                        </div>
+                        <div style="text-align: center">
+                          <div style="position: relative">
+                            硬盘 :
+                            <el-progress type="circle" :percentage="deviceRunInfo.externalUsage"></el-progress>
+                            <div style="position: absolute; top: -30px; left: 50%; transform: translateX(-50%)">
+                              {{ deviceRunInfo.externalUsage }}%
+                            </div>
+                          </div>
+                        </div>
+                      </div>
+                      <div>系统信息 : {{ deviceRunInfo.systemBuildVersion }}</div>
+                      <div>APK版本 : {{ deviceRunInfo.versionName }}</div>
+                    </div>-->
         </el-tab-pane>
         <el-tab-pane label="远程操作" name="control">
           <el-button :loading="buttonLoading" type="primary" @click="handleControl('reboot')">设备重启</el-button>
           <el-button :loading="buttonLoading" type="primary" @click="handleControl('start')">远程开机</el-button>
           <el-button :loading="buttonLoading" type="primary" @click="handleControl('shutdown')">远程关机</el-button>
           <el-button :loading="buttonLoading" type="primary" @click="handleControl('standby')">设备待机</el-button>
-          <el-button :loading="buttonLoading" type="primary" @click="handleVoice">音量调节</el-button>
-          <el-button :loading="buttonLoading" type="primary" @click="handleBrightness">亮度调节</el-button>
+          <!--          <el-button :loading="buttonLoading" type="primary" @click="handleVoice">音量调节</el-button>
+                    <el-button :loading="buttonLoading" type="primary" @click="handleBrightness">亮度调节</el-button>-->
         </el-tab-pane>
         <el-tab-pane label="报警信息" name="alarm">
           <el-table v-loading="loading" :data="alarmList" row-key="id">
@@ -287,40 +318,40 @@
 
 <script setup name="Device" lang="ts">
 import {
-  listDevice,
-  getDevice,
-  delDevice,
   addDevice,
-  updateDevice,
+  delDevice,
+  deviceStatistics,
+  getDevice,
+  getDeviceRunInfo,
+  getDeviceScreenshot,
+  listDevice,
   reboot,
-  start,
-  standby,
   shutdown,
+  standby,
+  start,
   startStream,
-  deviceStatistics,
-  getDeviceRunInfo,
   stopStream,
-  getDeviceScreenshot
+  updateDevice
 } from '@/api/smsb/device/device';
-import { DeviceVO, DeviceQuery, DeviceForm, DeviceStatisticsVo } from '@/api/smsb/device/device_type';
-import { ProductVO } from '@/api/smsb/device/product_types';
-import { listProduct } from '@/api/smsb/device/product';
-import { DeviceManufacturerVO } from '@/api/smsb/device/deviceManufacturer_type';
-import { listDeviceManufacturer } from '@/api/smsb/device/deviceManufacturer';
-import type { TabsPaneContext } from 'element-plus';
-import { ref, onBeforeUnmount } from 'vue';
+import {DeviceForm, DeviceQuery, DeviceStatisticsVo, DeviceVO} from '@/api/smsb/device/device_type';
+import {ProductVO} from '@/api/smsb/device/product_types';
+import {listProduct} from '@/api/smsb/device/product';
+import {DeviceManufacturerVO} from '@/api/smsb/device/deviceManufacturer_type';
+import {listDeviceManufacturer} from '@/api/smsb/device/deviceManufacturer';
+import type {TabsPaneContext} from 'element-plus';
+import {onBeforeUnmount, ref} from 'vue';
 import flvjs from 'flv.js';
-import { DeviceRunInfoVO } from '@/api/smsb/device/device_run_type';
-import { DeviceErrorRecordQuery, DeviceErrorRecordVO } from '@/api/smsb/device/errorRecord_type';
-import { listDeviceErrorRecord } from '@/api/smsb/device/errorRecord';
-import { storeToRefs } from 'pinia';
+import {DeviceRunInfoVO} from '@/api/smsb/device/device_run_type';
+import {DeviceErrorRecordQuery, DeviceErrorRecordVO} from '@/api/smsb/device/errorRecord_type';
+import {listDeviceErrorRecord} from '@/api/smsb/device/errorRecord';
+import {storeToRefs} from 'pinia';
 import useScreenshotStore from '@/store/modules/screenshot';
 
 const screenshotStore = storeToRefs(useScreenshotStore());
 const screenshotImageUrl = ref<string>();
 const alarmList = ref<DeviceErrorRecordVO[]>([]);
-const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { sys_device_online, smsb_yes_no, smsb_device_error_level, smsb_device_error_type } = toRefs<any>(
+const {proxy} = getCurrentInstance() as ComponentInternalInstance;
+const {sys_device_online, smsb_yes_no, smsb_device_error_level, smsb_device_error_type} = toRefs<any>(
   proxy?.useDict('sys_device_online', 'smsb_yes_no', 'smsb_device_error_level', 'smsb_device_error_type')
 );
 const deviceList = ref<DeviceVO[]>([]);
@@ -348,14 +379,18 @@ const deviceRunInfo = reactive<DeviceRunInfoVO>({
   deviceBase: undefined,
   id: undefined,
   deviceId: undefined,
-  cpuInfo: undefined,
-  memoryInfo: undefined,
-  diskInfo: undefined,
-  rom: undefined,
-  osInfo: undefined,
-  apkVersion: undefined,
-  download: undefined,
-  appList: undefined,
+  bright: undefined,
+  volume: undefined,
+  cpuUsage: undefined,
+  externalMemoryTotal: undefined,
+  externalMemoryUsage: undefined,
+  externalUsage: undefined,
+  ramTotalOfByte: undefined,
+  ramUsageOfByte: undefined,
+  systemBuildDate: undefined,
+  systemBuildVersion: undefined,
+  versionCode: undefined,
+  versionName: undefined,
   createTime: undefined
 });
 const dialog = reactive<DialogOption>({

+ 237 - 0
smsb-plus-ui/src/views/smsb/deviceLogin/index.vue

@@ -0,0 +1,237 @@
+<template>
+  <div class="p-2">
+    <transition :enter-active-class="proxy?.animate.searchAnimate.enter"
+                :leave-active-class="proxy?.animate.searchAnimate.leave">
+      <div v-show="showSearch" class="mb-[10px]">
+        <el-card shadow="hover" :style="{ marginTop: '10px', height: '60px' }">
+          <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="70px">
+            <el-form-item label="唯一标识" prop="reqIdentifier">
+              <el-input v-model="queryParams.reqIdentifier" placeholder="请输入请求标识" clearable @keyup.enter="handleQuery"/>
+            </el-form-item>
+            <el-form-item label="设备IP" prop="reqIp">
+              <el-input v-model="queryParams.reqIp" placeholder="请输入请求IP" clearable @keyup.enter="handleQuery"/>
+            </el-form-item>
+            <el-form-item label="登录结果" prop="loginResult">
+              <el-select v-model="form.loginResult" placeholder="请选择设备型号" clearable @keyup.enter="handleQuery">
+                <el-option v-for="dict in smsb_device_login_result" :key="dict.value" :label="dict.label"
+                           :value="dict.value"/>
+              </el-select>
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+            </el-form-item>
+          </el-form>
+        </el-card>
+      </div>
+    </transition>
+
+    <el-card shadow="never">
+      <!--      <template #header>
+              <el-row :gutter="10" class="mb8">
+                <el-col :span="1.5">
+                  <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['device:deviceLogin:add']">新增</el-button>
+                </el-col>
+                <el-col :span="1.5">
+                  <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['device:deviceLogin:edit']">修改</el-button>
+                </el-col>
+                <el-col :span="1.5">
+                  <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['device:deviceLogin:remove']">删除</el-button>
+                </el-col>
+                <el-col :span="1.5">
+                  <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['device:deviceLogin:export']">导出</el-button>
+                </el-col>
+                <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+              </el-row>
+            </template>-->
+
+      <el-table v-loading="loading" :data="deviceLoginList" @selection-change="handleSelectionChange">
+        <!--
+                <el-table-column type="selection" width="55" align="center" />
+        -->
+        <el-table-column label="ID" align="left" prop="id" v-if="true" width="180"
+                         :show-overflow-tooltip="true"/>
+        <el-table-column label="请求标识" align="left" prop="reqIdentifier" width="250" :show-overflow-tooltip="true"/>
+        <el-table-column label="请求IP" align="left" prop="reqIp" width="150" :show-overflow-tooltip="true"/>
+        <el-table-column label="登录结果" align="center" prop="loginResult" width="120">
+          <template #default="scope">
+            <dict-tag :options="smsb_device_login_result" :value="scope.row.loginResult"/>
+          </template>
+        </el-table-column>
+        <el-table-column label="登录时间" align="left" prop="createTime" width="160"/>
+        <el-table-column label="设备名称" align="left" prop="deviceName" width="220" :show-overflow-tooltip="true" />
+        <el-table-column label="设备标识" align="left" prop="identifier" width="250" :show-overflow-tooltip="true"/>
+        <el-table-column label="设备SN" align="left" prop="serialNumber" width="200" :show-overflow-tooltip="true" />
+        <el-table-column label="设备MAC" align="left" prop="mac" width="150" />
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
+          <template #default="scope">
+            <!--            <el-tooltip content="修改" placement="top">
+                          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['device:deviceLogin:edit']"></el-button>
+                        </el-tooltip>-->
+            <el-tooltip content="删除" placement="top">
+              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
+                         v-hasPermi="['device:deviceLogin:remove']"></el-button>
+            </el-tooltip>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+                  v-model:limit="queryParams.pageSize" @pagination="getList"/>
+    </el-card>
+    <!-- 添加或修改设备登录对话框 -->
+    <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
+      <el-form ref="deviceLoginFormRef" :model="form" :rules="rules" label-width="80px">
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup name="DeviceLogin" lang="ts">
+import {
+  addDeviceLogin,
+  delDeviceLogin,
+  getDeviceLogin,
+  listDeviceLogin,
+  updateDeviceLogin
+} from '@/api/smsb/device/device_login';
+import {DeviceLoginForm, DeviceLoginQuery, DeviceLoginVO} from '@/api/smsb/device/device_login_type';
+
+const {proxy} = getCurrentInstance() as ComponentInternalInstance;
+const {smsb_device_login_result} = toRefs<any>(
+  proxy?.useDict('smsb_device_login_result')
+);
+const deviceLoginList = ref<DeviceLoginVO[]>([]);
+const buttonLoading = ref(false);
+const loading = ref(true);
+const showSearch = ref(true);
+const ids = ref<Array<string | number>>([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+
+const queryFormRef = ref<ElFormInstance>();
+const deviceLoginFormRef = ref<ElFormInstance>();
+
+const dialog = reactive<DialogOption>({
+  visible: false,
+  title: ''
+});
+
+const initFormData: DeviceLoginForm = {}
+const data = reactive<PageData<DeviceLoginForm, DeviceLoginQuery>>({
+  form: {...initFormData},
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    reqIdentifier: undefined,
+    reqIp: undefined,
+    identifier: undefined,
+    loginResult: undefined,
+    params: {}
+  },
+  rules: {}
+});
+
+const {queryParams, form, rules} = toRefs(data);
+
+/** 查询设备登录列表 */
+const getList = async () => {
+  loading.value = true;
+  const res = await listDeviceLogin(queryParams.value);
+  deviceLoginList.value = res.rows;
+  total.value = res.total;
+  loading.value = false;
+}
+
+/** 取消按钮 */
+const cancel = () => {
+  reset();
+  dialog.visible = false;
+}
+
+/** 表单重置 */
+const reset = () => {
+  form.value = {...initFormData};
+  deviceLoginFormRef.value?.resetFields();
+}
+
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.value.pageNum = 1;
+  getList();
+}
+
+/** 重置按钮操作 */
+const resetQuery = () => {
+  queryFormRef.value?.resetFields();
+  handleQuery();
+}
+
+/** 多选框选中数据 */
+const handleSelectionChange = (selection: DeviceLoginVO[]) => {
+  ids.value = selection.map(item => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+
+/** 新增按钮操作 */
+const handleAdd = () => {
+  reset();
+  dialog.visible = true;
+  dialog.title = "添加设备登录";
+}
+
+/** 修改按钮操作 */
+const handleUpdate = async (row?: DeviceLoginVO) => {
+  reset();
+  const _id = row?.id || ids.value[0]
+  const res = await getDeviceLogin(_id);
+  Object.assign(form.value, res.data);
+  dialog.visible = true;
+  dialog.title = "修改设备登录";
+}
+
+/** 提交按钮 */
+const submitForm = () => {
+  deviceLoginFormRef.value?.validate(async (valid: boolean) => {
+    if (valid) {
+      buttonLoading.value = true;
+      if (form.value.id) {
+        await updateDeviceLogin(form.value).finally(() => buttonLoading.value = false);
+      } else {
+        await addDeviceLogin(form.value).finally(() => buttonLoading.value = false);
+      }
+      proxy?.$modal.msgSuccess("操作成功");
+      dialog.visible = false;
+      await getList();
+    }
+  });
+}
+
+/** 删除按钮操作 */
+const handleDelete = async (row?: DeviceLoginVO) => {
+  const _ids = row?.id || ids.value;
+  await proxy?.$modal.confirm('是否确认删除设备登录编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
+  await delDeviceLogin(_ids);
+  proxy?.$modal.msgSuccess("删除成功");
+  await getList();
+}
+
+/** 导出按钮操作 */
+const handleExport = () => {
+  proxy?.download('device/deviceLogin/export', {
+    ...queryParams.value
+  }, `deviceLogin_${new Date().getTime()}.xlsx`)
+}
+
+onMounted(() => {
+  getList();
+});
+</script>