Переглянути джерело

设备获取信息展示后台

yinhao 4 роки тому
батько
коміт
b448fcecd8
25 змінених файлів з 1769 додано та 0 видалено
  1. 16 0
      huimv-test-platform/huimv-ctwing-manage/pom.xml
  2. 32 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/annotation/ExpEnumType.java
  3. 110 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/consts/CommonConstant.java
  4. 65 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/consts/ExpEnumConstant.java
  5. 42 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/context/requestno/RequestNoContext.java
  6. 123 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/error/GlobalExceptionHandler.java
  7. 32 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/exception/ServiceException.java
  8. 51 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/exception/enums/ServerExceptionEnum.java
  9. 29 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/exception/enums/abs/AbstractBaseExceptionEnum.java
  10. 30 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/factory/ExpEnumCodeFactory.java
  11. 82 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/controller/DeviceDataController.java
  12. 178 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/entity/DeviceIncidentReportEntity.java
  13. 131 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/entity/DeviceResponseEntity.java
  14. 108 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/entity/DeviceUpAndDownEntity.java
  15. 233 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/entity/DeviceUpdataEntity.java
  16. 24 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/repo/DeviceIncidentReportRepository.java
  17. 29 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/repo/DeviceResponseEntityRepository.java
  18. 25 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/repo/DeviceUpAndDownRepository.java
  19. 27 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/repo/DeviceUpdataEntityRepository.java
  20. 53 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/serivice/DeviceDataService.java
  21. 100 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/serivice/impl/DeviceDataServiceImpl.java
  22. 56 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/response/ErrorResponseData.java
  23. 99 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/response/ResponseData.java
  24. 46 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/response/SuccessResponseData.java
  25. 48 0
      huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/util/ResponseUtil.java

+ 16 - 0
huimv-test-platform/huimv-ctwing-manage/pom.xml

@@ -11,5 +11,21 @@
 
     <artifactId>huimv-ctwing-manage</artifactId>
 
+    <dependencies>
+        <!--lombok-->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <!--hu-tool-->
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.5.8</version>
+        </dependency>
+    </dependencies>
+
 
 </project>

+ 32 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/annotation/ExpEnumType.java

@@ -0,0 +1,32 @@
+package com.huimv.devicedata.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * 标识在ExceptionEnum类上,用来标识类级别异常枚举编码
+ * <p>
+ * 异常枚举编码由3部分组成,如下:
+ * <p>
+ * 模块编码(2位) + 分类编码(4位) + 具体项编码(至少1位)
+ * <p>
+ * 模块编码和分类编码在ExpEnumCodeConstant类中声明
+ *
+ * @author yubaoshan
+ * @date 2020/6/19 20:46
+ */
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE})
+public @interface ExpEnumType {
+
+    /**
+     * 模块编码
+     */
+    int module() default 99;
+
+    /**
+     * 分类编码
+     */
+    int kind() default 9999;
+
+}

+ 110 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/consts/CommonConstant.java

@@ -0,0 +1,110 @@
+package com.huimv.devicedata.consts;
+
+/**
+ * 通用常量
+ *
+ * @author xuyuxiang yubaoshan
+ * @date 2020/3/11 16:51
+ */
+public interface CommonConstant {
+
+    /**
+     * id
+     */
+    String ID = "id";
+
+    /**
+     * 名称
+     */
+    String NAME = "name";
+
+    /**
+     * 编码
+     */
+    String CODE = "code";
+
+    /**
+     * 值
+     */
+    String VALUE = "value";
+
+    /**
+     * 默认标识状态的字段名称
+     */
+    String STATUS = "status";
+
+    /**
+     * 默认逻辑删除的状态值
+     */
+    String DEFAULT_LOGIC_DELETE_VALUE = "2";
+
+    /**
+     * 用户代理
+     */
+    String USER_AGENT = "User-Agent";
+
+    /**
+     * 请求头token表示
+     */
+    String AUTHORIZATION = "Authorization";
+
+    /**
+     * token名称
+     */
+    String TOKEN_NAME = "token";
+
+    /**
+     * token类型
+     */
+    String TOKEN_TYPE_BEARER = "Bearer";
+
+    /**
+     * 首页提示语
+     */
+    String INDEX_TIPS = "Welcome To XiaoNuo";
+
+    /**
+     * 未知标识
+     */
+    String UNKNOWN = "Unknown";
+
+    /**
+     * 默认包名
+     */
+    String DEFAULT_PACKAGE_NAME = "com.huimv.devicedata";
+
+    /**
+     * 默认密码
+     */
+    String DEFAULT_PASSWORD = "123456";
+
+    /**
+     * 请求号在header中的唯一标识
+     */
+    String REQUEST_NO_HEADER_NAME = "Request-No";
+
+    /**
+     * 数据库链接URL标识
+     */
+    String DATABASE_URL_NAME = "DATABASE_URL_NAME";
+
+    /**
+     * 数据库链接驱动标识
+     */
+    String DATABASE_DRIVER_NAME = "DATABASE_DRIVER_NAME";
+
+    /**
+     * 数据库用户标识
+     */
+    String DATABASE_USER_NAME = "DATABASE_USER_NAME";
+
+    /**
+     * 点选验证码
+     */
+    String IMAGE_CODE_TYPE = "clickWord";
+
+    /**
+     * undefined未知
+     */
+    String UNDEFINED = "undefined";
+}

+ 65 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/consts/ExpEnumConstant.java

@@ -0,0 +1,65 @@
+package com.huimv.devicedata.consts;
+
+/**
+ * 异常枚举编码构成常量
+ * <p>
+ * 异常枚举编码由3部分组成,如下:
+ * <p>
+ * 模块编码(2位) + 分类编码(4位) + 具体项编码(至少1位)
+ * <p>
+ * 模块编码和分类编码在ExpEnumCodeConstant类中声明
+ *
+ * @author yubaoshan
+ * @date 2020/6/19 20:46
+ */
+public interface ExpEnumConstant {
+
+    /**
+     * 模块分类编码(2位)
+     * <p>
+     * xiaonuo-core模块异常枚举编码
+     */
+    int XIAONUO_CORE_MODULE_EXP_CODE = 10;
+
+    /* 分类编码(4位) */
+    /**
+     * 认证异常枚举
+     */
+    int AUTH_EXCEPTION_ENUM = 1100;
+
+    /**
+     * 参数校验异常枚举
+     */
+    int PARAM_EXCEPTION_ENUM = 1200;
+
+    /**
+     * 授权和鉴权异常的枚举
+     */
+    int PERMISSION_EXCEPTION_ENUM = 1300;
+
+    /**
+     * 请求方法相关异常枚举
+     */
+    int REQUEST_METHOD_EXCEPTION_ENUM = 1400;
+
+    /**
+     * 请求类型相关异常枚举
+     */
+    int REQUEST_TYPE_EXCEPTION_ENUM = 1500;
+
+    /**
+     * 服务器内部相关异常枚举
+     */
+    int SERVER_EXCEPTION_ENUM = 1600;
+
+    /**
+     * 状态相关异常枚举
+     */
+    int STATUS_EXCEPTION_ENUM = 1700;
+
+    /**
+     * 包装相关异常枚举
+     */
+    int WRAPPER_EXCEPTION_ENUM = 1800;
+
+}

+ 42 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/context/requestno/RequestNoContext.java

@@ -0,0 +1,42 @@
+package com.huimv.devicedata.context.requestno;
+
+/**
+ * 临时保存当前请求号
+ *
+ * @author yubaoshan
+ * @date 2020/6/21 20:17
+ */
+public class RequestNoContext {
+
+    private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();
+
+    /**
+     * 保存请求号
+     *
+     * @author yubaoshan
+     * @date 2020/6/21 20:17
+     */
+    public static void set(String requestNo) {
+        CONTEXT_HOLDER.set(requestNo);
+    }
+
+    /**
+     * 获取请求号
+     *
+     * @author yubaoshan
+     * @date 2020/6/21 20:17
+     */
+    public static String get() {
+        return CONTEXT_HOLDER.get();
+    }
+
+    /**
+     * 清除请求号
+     *
+     * @author yubaoshan
+     * @date 2020/6/21 20:17
+     */
+    public static void clear() {
+        CONTEXT_HOLDER.remove();
+    }
+}

+ 123 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/error/GlobalExceptionHandler.java

@@ -0,0 +1,123 @@
+package com.huimv.devicedata.error;
+
+
+import cn.hutool.core.util.ObjectUtil;
+import com.huimv.devicedata.consts.CommonConstant;
+import com.huimv.devicedata.context.requestno.RequestNoContext;
+import com.huimv.devicedata.exception.ServiceException;
+import com.huimv.devicedata.exception.enums.ServerExceptionEnum;
+import com.huimv.devicedata.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.devicedata.response.ErrorResponseData;
+import com.huimv.devicedata.util.ResponseUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+/**
+ * @author yinhao
+ * @descriprtion 全局异常处理
+ */
+@ControllerAdvice
+public class GlobalExceptionHandler {
+
+    public static Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
+
+
+    /**
+     * 拦截业务异常
+     *
+     * @author xuyuxiang
+     * @date 2020/3/18 19:41
+     */
+    @ExceptionHandler(ServiceException.class)
+    @ResponseBody
+    public ErrorResponseData businessError(ServiceException e) {
+        log.error(">>> 业务异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage());
+        return renderJson(e.getCode(), e.getErrorMessage(), e);
+    }
+
+
+
+    /**
+     * 拦截未知的运行时异常
+     *
+     * @author xuyuxiang
+     * @date 2020/3/18 19:41
+     */
+    @ExceptionHandler(Throwable.class)
+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+    @ResponseBody
+    public ErrorResponseData serverError(Throwable e) {
+        log.error(">>> 服务器运行异常,请求号为:{}", RequestNoContext.get());
+        e.printStackTrace();
+        return renderJson(e);
+    }
+
+    /**
+     * 渲染异常json
+     *
+     * @author yubaoshan
+     * @date 2020/5/5 16:22
+     */
+    private ErrorResponseData renderJson(Integer code, String message) {
+        return renderJson(code, message, null);
+    }
+
+    /**
+     * 渲染异常json
+     *
+     * @author yubaoshan
+     * @date 2020/5/5 16:22
+     */
+    private ErrorResponseData renderJson(AbstractBaseExceptionEnum baseExceptionEnum) {
+        return renderJson(baseExceptionEnum.getCode(), baseExceptionEnum.getMessage(), null);
+    }
+
+    /**
+     * 渲染异常json
+     *
+     * @author yubaoshan
+     * @date 2020/5/5 16:22
+     */
+    private ErrorResponseData renderJson(Throwable throwable) {
+        return renderJson(((AbstractBaseExceptionEnum) ServerExceptionEnum.SERVER_ERROR).getCode(),
+                ((AbstractBaseExceptionEnum) ServerExceptionEnum.SERVER_ERROR).getMessage(), throwable);
+    }
+
+    /**
+     * 渲染异常json
+     * <p>
+     * 根据异常枚举和Throwable异常响应,异常信息响应堆栈第一行
+     *
+     * @author yubaoshan
+     * @date 2020/5/5 16:22
+     */
+    private ErrorResponseData renderJson(Integer code, String message, Throwable e) {
+        if (ObjectUtil.isNotNull(e)) {
+
+            //获取所有堆栈信息
+            StackTraceElement[] stackTraceElements = e.getStackTrace();
+
+            //默认的异常类全路径为第一条异常堆栈信息的
+            String exceptionClassTotalName = stackTraceElements[0].toString();
+
+            //遍历所有堆栈信息,找到com.huimv.devicedata
+            for (StackTraceElement stackTraceElement : stackTraceElements) {
+                if (stackTraceElement.toString().contains(CommonConstant.DEFAULT_PACKAGE_NAME)) {
+                    exceptionClassTotalName = stackTraceElement.toString();
+                    break;
+                }
+            }
+            return ResponseUtil.responseDataError(code, message, exceptionClassTotalName);
+        } else {
+            return ResponseUtil.responseDataError(code, message, null);
+        }
+    }
+
+
+
+}

+ 32 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/exception/ServiceException.java

@@ -0,0 +1,32 @@
+package com.huimv.devicedata.exception;
+
+import com.huimv.devicedata.exception.enums.abs.AbstractBaseExceptionEnum;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 业务异常
+ *
+ * @author xuyuxiang
+ * @date 2020/4/8 15:54
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ServiceException extends RuntimeException {
+
+    private Integer code;
+
+    private String errorMessage;
+
+    public ServiceException(Integer code, String errorMessage) {
+        super(errorMessage);
+        this.code = code;
+        this.errorMessage = errorMessage;
+    }
+
+    public ServiceException(AbstractBaseExceptionEnum exception) {
+        super(exception.getMessage());
+        this.code = exception.getCode();
+        this.errorMessage = exception.getMessage();
+    }
+}

+ 51 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/exception/enums/ServerExceptionEnum.java

@@ -0,0 +1,51 @@
+package com.huimv.devicedata.exception.enums;
+
+import com.huimv.devicedata.annotation.ExpEnumType;
+import com.huimv.devicedata.consts.ExpEnumConstant;
+import com.huimv.devicedata.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.devicedata.factory.ExpEnumCodeFactory;
+
+/**
+ * 服务器内部相关异常枚举
+ *
+ * @author xuyuxiang
+ * @date 2020/3/18 19:19
+ */
+@ExpEnumType(module = ExpEnumConstant.XIAONUO_CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.SERVER_EXCEPTION_ENUM)
+public enum ServerExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 当前请求参数为空或数据缺失
+     */
+    REQUEST_EMPTY(1, "当前请求参数为空或数据缺失,请联系管理员"),
+
+    /**
+     * 服务器出现未知异常
+     */
+    SERVER_ERROR(2, "服务器出现异常,请联系管理员"),
+
+    /**
+     * 常量获取存在空值
+     */
+    CONSTANT_EMPTY(3, "常量获取存在空值,请检查sys_config中是否配置");
+
+    private final Integer code;
+
+    private final String message;
+
+    ServerExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 29 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/exception/enums/abs/AbstractBaseExceptionEnum.java

@@ -0,0 +1,29 @@
+package com.huimv.devicedata.exception.enums.abs;
+
+/**
+ * 异常枚举格式规范
+ *
+ * @author yubaoshan
+ * @date 2017/12/17 22:22
+ */
+public interface AbstractBaseExceptionEnum {
+
+    /**
+     * 获取异常的状态码
+     *
+     * @return 状态码
+     * @author yubaoshan
+     * @date 2020/7/9 14:28
+     */
+    Integer getCode();
+
+    /**
+     * 获取异常的提示信息
+     *
+     * @return 提示信息
+     * @author yubaoshan
+     * @date 2020/7/9 14:28
+     */
+    String getMessage();
+
+}

+ 30 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/factory/ExpEnumCodeFactory.java

@@ -0,0 +1,30 @@
+package com.huimv.devicedata.factory;
+
+import com.huimv.devicedata.annotation.ExpEnumType;
+
+/**
+ * 异常枚举code值快速创建
+ *
+ * @author yubaoshan
+ * @date 2020/6/19 21:30
+ */
+public class ExpEnumCodeFactory {
+
+    public static Integer getExpEnumCode(Class<?> clazz, int code) {
+
+        // 默认的异常响应码
+        Integer defaultCode = Integer.valueOf("" + 99 + 9999 + 9);
+
+        if (clazz == null) {
+            return defaultCode;
+        } else {
+            ExpEnumType expEnumType = clazz.getAnnotation(ExpEnumType.class);
+            if (expEnumType == null) {
+                return defaultCode;
+            }
+            return Integer.valueOf("" + expEnumType.module() + expEnumType.kind() + code);
+        }
+
+    }
+
+}

+ 82 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/controller/DeviceDataController.java

@@ -0,0 +1,82 @@
+package com.huimv.devicedata.modular.controller;
+
+
+import com.huimv.devicedata.modular.serivice.DeviceDataService;
+import com.huimv.devicedata.response.ResponseData;
+import com.huimv.devicedata.response.SuccessResponseData;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author yinhao
+ * @description 设备数据展示controller
+ */
+@RestController
+@RequestMapping(value = "/deviceData")
+public class DeviceDataController {
+
+//    public static Logger logger = LoggerFactory.getLogger(DeviceDataController.class);
+
+    @Autowired
+    private DeviceDataService deviceDataService;
+
+
+    /**
+     * 设备数据变化
+     * @param pageNum 当前页
+     * @param pageSize 每页条数
+     * @param keyword 搜索关键字
+     * @return
+     */
+    @RequestMapping(value = "/change", method = {RequestMethod.POST, RequestMethod.GET})
+    public ResponseData pageChange(@RequestParam(value = "pageNum") Integer pageNum,
+                                     @RequestParam(value = "pageSize") Integer pageSize,
+                                     @RequestParam(value = "keyword", required = false) String keyword) {
+        return new SuccessResponseData(deviceDataService.pageChange(pageNum, pageSize, keyword));
+    }
+
+    /**
+     * 设备命令响应
+     * @param pageNum 当前页
+     * @param pageSize 每页条数
+     * @param keyword 搜索关键字
+     * @return
+     */
+    @RequestMapping(value = "/response", method = {RequestMethod.POST, RequestMethod.GET})
+    public ResponseData pageResponse(@RequestParam(value = "pageNum") Integer pageNum,
+                                   @RequestParam(value = "pageSize") Integer pageSize,
+                                   @RequestParam(value = "keyword", required = false) String keyword) {
+        return new SuccessResponseData(deviceDataService.pageResponse(pageNum, pageSize, keyword));
+    }
+
+    /**
+     * 设备事件上报
+     * @param pageNum 当前页
+     * @param pageSize 每页条数
+     * @param keyword 搜索关键字
+     * @return
+     */
+    @RequestMapping(value = "/incidentReport", method = {RequestMethod.POST, RequestMethod.GET})
+    public ResponseData pageIncidentReport(@RequestParam(value = "pageNum") Integer pageNum,
+                                     @RequestParam(value = "pageSize") Integer pageSize,
+                                     @RequestParam(value = "keyword", required = false) String keyword) {
+        return new SuccessResponseData(deviceDataService.pageIncidentReport(pageNum, pageSize, keyword));
+    }
+
+    /**
+     * 设备上下线
+     * @param pageNum 当前页
+     * @param pageSize 每页条数
+     * @param keyword 搜索关键字
+     * @return
+     */
+    @RequestMapping(value = "/incidentReport", method = {RequestMethod.POST, RequestMethod.GET})
+    public ResponseData pageUpAndDown(@RequestParam(value = "pageNum") Integer pageNum,
+                                           @RequestParam(value = "pageSize") Integer pageSize,
+                                           @RequestParam(value = "keyword", required = false) String keyword) {
+        return new SuccessResponseData(deviceDataService.pageUpAndDown(pageNum, pageSize, keyword));
+    }
+}

+ 178 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/entity/DeviceIncidentReportEntity.java

@@ -0,0 +1,178 @@
+package com.huimv.devicedata.modular.entity;
+
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * @author yinhao
+ */
+@Entity
+@Table(name = "device_incident_report")
+public class DeviceIncidentReportEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "id", nullable = false)
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    @Column(name = "tenantId")
+    private String tenantId;
+
+    @Column(name = "productId")
+    private String productId;
+
+    @Column(name = "deviceId")
+    private String deviceId;
+
+    @Column(name = "messageType")
+    private String messageType;
+
+    @Column(name = "imei")
+    private String imei;
+
+    @Column(name = "imsi")
+    private String imsi;
+
+    @Column(name = "deviceSn")
+    private String deviceSn;
+
+    @Column(name = "timestamp")
+    private String timestamp;
+
+    @Column(name = "eventType")
+    private Integer eventType;
+
+    @Column(name = "eventContent")
+    private String eventContent;
+
+    @Column(name = "serviceId")
+    private Integer serviceId;
+
+    @Column(name = "protocol")
+    private String protocol;
+    // device_incident_report
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getProductId() {
+        return productId;
+    }
+
+    public void setProductId(String productId) {
+        this.productId = productId;
+    }
+
+    public String getDeviceId() {
+        return deviceId;
+    }
+
+    public void setDeviceId(String deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    public String getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(String messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getImei() {
+        return imei;
+    }
+
+    public void setImei(String imei) {
+        this.imei = imei;
+    }
+
+    public String getImsi() {
+        return imsi;
+    }
+
+    public void setImsi(String imsi) {
+        this.imsi = imsi;
+    }
+
+    public String getDeviceSn() {
+        return deviceSn;
+    }
+
+    public void setDeviceSn(String deviceSn) {
+        this.deviceSn = deviceSn;
+    }
+
+
+    public void setTimestamp(String timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public Integer getEventType() {
+        return eventType;
+    }
+
+    public void setEventType(Integer eventType) {
+        this.eventType = eventType;
+    }
+
+    public String getEventContent() {
+        return eventContent;
+    }
+
+    public void setEventContent(String eventContent) {
+        this.eventContent = eventContent;
+    }
+
+    public Integer getServiceId() {
+        return serviceId;
+    }
+
+    public void setServiceId(Integer serviceId) {
+        this.serviceId = serviceId;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceIncidentReportEntity{" +
+                "id=" + id +
+                ", tenantId='" + tenantId + '\'' +
+                ", productId='" + productId + '\'' +
+                ", deviceId='" + deviceId + '\'' +
+                ", messageType='" + messageType + '\'' +
+                ", imei='" + imei + '\'' +
+                ", imsi='" + imsi + '\'' +
+                ", deviceSn='" + deviceSn + '\'' +
+                ", timestamp=" + timestamp +
+                ", eventType=" + eventType +
+                ", eventContent='" + eventContent + '\'' +
+                ", serviceId=" + serviceId +
+                ", protocol='" + protocol + '\'' +
+                '}';
+    }
+}

+ 131 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/entity/DeviceResponseEntity.java

@@ -0,0 +1,131 @@
+package com.huimv.devicedata.modular.entity;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * @Author yinhao
+ * @Date 2021/3/31 17:51
+ * @Description
+ */
+@Entity
+@Table(name = "device_response")
+public class DeviceResponseEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+
+    @Column(name = "tenan_id")
+    private String tenanId;
+
+    @Column(name = "product_id")
+    private String productId;
+
+    @Column(name = "message_type")
+    private String messageType;
+
+    @Column(name = "device_id")
+    private String deviceId;
+
+    @Column(name = "task_id")
+    private Integer taskId;
+
+    @Column(name = "result_code")
+    private String resultCode;
+
+    @Column(name = "result_detail_length")
+    private Integer resultDetailLength;
+
+    @Column(name = "result_detail_rsa_data")
+    private String resultDetailRspData;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getProductId() {
+        return productId;
+    }
+
+    public void setProductId(String productId) {
+        this.productId = productId;
+    }
+
+    public String getTenanId() {
+        return tenanId;
+    }
+
+    public void setTenanId(String tenanId) {
+        this.tenanId = tenanId;
+    }
+
+    public String getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(String messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getDeviceId() {
+        return deviceId;
+    }
+
+    public void setDeviceId(String deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    public Integer getTaskId() {
+        return taskId;
+    }
+
+    public void setTaskId(Integer taskId) {
+        this.taskId = taskId;
+    }
+
+    public String getResultCode() {
+        return resultCode;
+    }
+
+    public void setResultCode(String resultCode) {
+        this.resultCode = resultCode;
+    }
+
+    public Integer getResultDetailLength() {
+        return resultDetailLength;
+    }
+
+    public void setResultDetailLength(Integer resultDetailLength) {
+        this.resultDetailLength = resultDetailLength;
+    }
+
+    public String getResultDetailRspData() {
+        return resultDetailRspData;
+    }
+
+    public void setResultDetailRspData(String resultDetailRspData) {
+        this.resultDetailRspData = resultDetailRspData;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceResponseEntity{" +
+                "id=" + id +
+                ", tenanId=" + tenanId +
+                ", productId='" + productId + '\'' +
+                ", messageType='" + messageType + '\'' +
+                ", deviceId='" + deviceId + '\'' +
+                ", taskId=" + taskId +
+                ", resultCode='" + resultCode + '\'' +
+                ", resultDetailLength=" + resultDetailLength +
+                ", resultDetailRspData='" + resultDetailRspData + '\'' +
+                '}';
+    }
+}

+ 108 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/entity/DeviceUpAndDownEntity.java

@@ -0,0 +1,108 @@
+package com.huimv.devicedata.modular.entity;
+
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ * @author yinhao
+ */
+@Entity
+@Table(name = "device_up_and_down")
+public class DeviceUpAndDownEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Id
+    @Column(name = "id", nullable = false)
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Integer id;
+
+    @Column(name = "tenantId")
+    private String tenantId;
+
+    @Column(name = "productId")
+    private String productId;
+
+    @Column(name = "deviceId")
+    private String deviceId;
+
+    @Column(name = "messageType")
+    private String messageType;
+
+    @Column(name = "eventType")
+    private Integer eventType;
+
+    @Column(name = "timestamp")
+    private String timestamp;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    public String getProductId() {
+        return productId;
+    }
+
+    public void setProductId(String productId) {
+        this.productId = productId;
+    }
+
+    public String getDeviceId() {
+        return deviceId;
+    }
+
+    public void setDeviceId(String deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    public String getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(String messageType) {
+        this.messageType = messageType;
+    }
+
+    public Integer getEventType() {
+        return eventType;
+    }
+
+    public void setEventType(Integer eventType) {
+        this.eventType = eventType;
+    }
+
+    public void setTimestamp(String timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public String getTimestamp() {
+        return timestamp;
+    }
+
+
+    @Override
+    public String toString() {
+        return "DeviceUpAndDownEntity{" +
+                "id=" + id +
+                ", tenantId='" + tenantId + '\'' +
+                ", productId='" + productId + '\'' +
+                ", deviceId='" + deviceId + '\'' +
+                ", messageType='" + messageType + '\'' +
+                ", eventType=" + eventType +
+                ", timestamp=" + timestamp +
+                '}';
+    }
+}

+ 233 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/entity/DeviceUpdataEntity.java

@@ -0,0 +1,233 @@
+package com.huimv.devicedata.modular.entity;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "device_up_data")
+public class DeviceUpdataEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id", nullable = false)
+    private Integer id;
+    @Column(name = "product_id")
+    private String productId;
+
+    @Column(name = "device_id")
+    private String deviceId;
+
+    @Column(name = "timestamp")
+    private String timestamp;
+
+    @Column(name = "service_id")
+    private String serviceId;
+
+    @Column(name = "protocol")
+    private String protocol;
+
+    @Column(name = "imsi")
+    private String imsi;
+
+    @Column(name = "imei")
+    private String imei;
+
+    @Column(name = "device_type")
+    private String deviceType;
+
+    @Column(name = "message_type")
+    private String messageType;
+
+    @Column(name = "data_ver")
+    private Integer dataVer;
+
+    @Column(name = "data_time")
+    private Integer dataTime;
+
+    @Column(name = "data_temp")
+    private Integer dataTemp;
+
+    @Column(name = "data_stc")
+    private Integer dataStc;
+
+    @Column(name = "data_rssi")
+    private Integer dataRssi;
+
+    @Column(name = "data_humi")
+    private Integer dataHumi;
+
+    @Column(name = "data_bat")
+    private Integer dataBat;
+
+    @Column(name = "tenant_id")
+    private String tenantId;
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setProductId(String productId) {
+        this.productId = productId;
+    }
+
+    public String getProductId() {
+        return productId;
+    }
+
+    public void setDeviceId(String deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    public String getDeviceId() {
+        return deviceId;
+    }
+
+    public void setTimestamp(String timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public String getTimestamp() {
+        return timestamp;
+    }
+
+    public void setServiceId(String serviceId) {
+        this.serviceId = serviceId;
+    }
+
+    public String getServiceId() {
+        return serviceId;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setImsi(String imsi) {
+        this.imsi = imsi;
+    }
+
+    public String getImsi() {
+        return imsi;
+    }
+
+    public void setImei(String imei) {
+        this.imei = imei;
+    }
+
+    public String getImei() {
+        return imei;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setMessageType(String messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getMessageType() {
+        return messageType;
+    }
+
+    public void setDataVer(Integer dataVer) {
+        this.dataVer = dataVer;
+    }
+
+    public Integer getDataVer() {
+        return dataVer;
+    }
+
+    public void setDataTime(Integer dataTime) {
+        this.dataTime = dataTime;
+    }
+
+    public Integer getDataTime() {
+        return dataTime;
+    }
+
+    public void setDataTemp(Integer dataTemp) {
+        this.dataTemp = dataTemp;
+    }
+
+    public Integer getDataTemp() {
+        return dataTemp;
+    }
+
+    public void setDataStc(Integer dataStc) {
+        this.dataStc = dataStc;
+    }
+
+    public Integer getDataStc() {
+        return dataStc;
+    }
+
+    public void setDataRssi(Integer dataRssi) {
+        this.dataRssi = dataRssi;
+    }
+
+    public Integer getDataRssi() {
+        return dataRssi;
+    }
+
+    public void setDataHumi(Integer dataHumi) {
+        this.dataHumi = dataHumi;
+    }
+
+    public Integer getDataHumi() {
+        return dataHumi;
+    }
+
+    public void setDataBat(Integer dataBat) {
+        this.dataBat = dataBat;
+    }
+
+    public Integer getDataBat() {
+        return dataBat;
+    }
+
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceUpdataEntity{" +
+                "id=" + id +
+                ", productId='" + productId + '\'' +
+                ", deviceId='" + deviceId + '\'' +
+                ", timestamp=" + timestamp +
+                ", serviceId='" + serviceId + '\'' +
+                ", protocol='" + protocol + '\'' +
+                ", imsi='" + imsi + '\'' +
+                ", imei='" + imei + '\'' +
+                ", deviceType='" + deviceType + '\'' +
+                ", messageType='" + messageType + '\'' +
+                ", dataVer=" + dataVer +
+                ", dataTime=" + dataTime +
+                ", dataTemp=" + dataTemp +
+                ", dataStc=" + dataStc +
+                ", dataRssi=" + dataRssi +
+                ", dataHumi=" + dataHumi +
+                ", dataBat=" + dataBat +
+                ", tenantId='" + tenantId + '\'' +
+                '}';
+    }
+}

+ 24 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/repo/DeviceIncidentReportRepository.java

@@ -0,0 +1,24 @@
+package com.huimv.devicedata.modular.repo;
+
+import com.huimv.devicedata.modular.entity.DeviceIncidentReportEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+
+/**
+ * @author yinhao
+ */
+public interface DeviceIncidentReportRepository extends JpaRepository<DeviceIncidentReportEntity, Integer>, JpaSpecificationExecutor<DeviceIncidentReportEntity> {
+
+    /**
+     * 设备事件上报分页条件查询
+     * @param start
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    @Query(nativeQuery = true,value = "select * from device_incident_report where tenant_id like %?3% limit ?1,?2")
+    List<DeviceIncidentReportEntity> getDeviceIncidentReportListByPage(Integer start, Integer pageSize, String keyword);
+}

+ 29 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/repo/DeviceResponseEntityRepository.java

@@ -0,0 +1,29 @@
+package com.huimv.devicedata.modular.repo;
+
+import com.huimv.devicedata.modular.entity.DeviceResponseEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author yinhao
+ * @Date 2021/3/31 18:18
+ * @Description
+ */
+public interface DeviceResponseEntityRepository extends JpaRepository<DeviceResponseEntity, Integer>, JpaSpecificationExecutor<DeviceResponseEntity> {
+
+    /**
+     * 设备命令响应分页条件查询
+     * @param start
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    @Query(nativeQuery = true, value = "SELECT\n" +
+            "id,tenan_id,product_id,message_type,device_Id,task_id,result_code,result_detail_length,result_detail_rsa_data\n" +
+            "FROM device_response WHERE tenan_id LIKE %?3% OR product_id LIKE %?3% LIMIT ?1,?2")
+    List<DeviceResponseEntity> getDeviceResponseListByPage(Integer start, Integer pageSize, String keyword);
+}

+ 25 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/repo/DeviceUpAndDownRepository.java

@@ -0,0 +1,25 @@
+package com.huimv.devicedata.modular.repo;
+
+import com.huimv.devicedata.modular.entity.DeviceUpAndDownEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+
+/**
+ * @author yinhao
+ * @description 设备上下线
+ */
+public interface DeviceUpAndDownRepository extends JpaRepository<DeviceUpAndDownEntity, Integer>, JpaSpecificationExecutor<DeviceUpAndDownEntity> {
+
+    /**
+     * 设备上下线分页条件查询
+     * @param start
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    @Query(nativeQuery = true,value = "select * from device_up_and_down where tenant_id like %?3% limit ?1,?2")
+    List<DeviceUpAndDownEntity> getDeviceUpAndDownListByPage(Integer start, Integer pageSize, String keyword);
+}

+ 27 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/repo/DeviceUpdataEntityRepository.java

@@ -0,0 +1,27 @@
+package com.huimv.devicedata.modular.repo;
+
+import com.huimv.devicedata.modular.entity.DeviceResponseEntity;
+import com.huimv.devicedata.modular.entity.DeviceUpdataEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+
+/**
+ * @author yinhao
+ * @description
+ */
+public interface DeviceUpdataEntityRepository extends JpaRepository<DeviceUpdataEntity, Integer>, JpaSpecificationExecutor<DeviceUpdataEntity> {
+
+    /**
+     * 设备数据变化分页条件查询
+     * @param start
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    @Query(nativeQuery = true,value = "select * from device_up_data where tenant_id like %?3% limit ?1,?2")
+    List<DeviceUpdataEntity> getDeviceUpdataListByPage(Integer start, Integer pageSize, String keyword);
+
+}

+ 53 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/serivice/DeviceDataService.java

@@ -0,0 +1,53 @@
+package com.huimv.devicedata.modular.serivice;
+
+import java.util.Map;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/6 14:07
+ * @Description
+ */
+public interface DeviceDataService {
+
+    /**
+     * 设备数据变化分页展示
+     *
+     * @param pageNum
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    Map<String, Object> pageChange(Integer pageNum, Integer pageSize, String keyword);
+
+    /**
+     * 设备命令响应分页展示
+     *
+     * @param pageNum
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    Map<String, Object> pageResponse(Integer pageNum, Integer pageSize, String keyword);
+
+
+    /**
+     * 设备事件上报
+     *
+     * @param pageNum
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    Map<String, Object> pageIncidentReport(Integer pageNum, Integer pageSize, String keyword);
+
+
+    /**
+     * 设备上下线
+     *
+     * @param pageNum
+     * @param pageSize
+     * @param keyword
+     * @return
+     */
+    Map<String, Object> pageUpAndDown(Integer pageNum, Integer pageSize, String keyword);
+}

+ 100 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/modular/serivice/impl/DeviceDataServiceImpl.java

@@ -0,0 +1,100 @@
+package com.huimv.devicedata.modular.serivice.impl;
+
+import com.huimv.devicedata.modular.entity.DeviceIncidentReportEntity;
+import com.huimv.devicedata.modular.entity.DeviceResponseEntity;
+import com.huimv.devicedata.modular.entity.DeviceUpAndDownEntity;
+import com.huimv.devicedata.modular.entity.DeviceUpdataEntity;
+import com.huimv.devicedata.modular.repo.DeviceIncidentReportRepository;
+import com.huimv.devicedata.modular.repo.DeviceResponseEntityRepository;
+import com.huimv.devicedata.modular.repo.DeviceUpAndDownRepository;
+import com.huimv.devicedata.modular.repo.DeviceUpdataEntityRepository;
+import com.huimv.devicedata.modular.serivice.DeviceDataService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author yinhao
+ * @Date 2021/4/6 14:08
+ * @Description
+ */
+@Service
+public class DeviceDataServiceImpl implements DeviceDataService {
+
+
+    @Resource
+    private DeviceUpdataEntityRepository deviceUpdataEntityRepository;
+
+    @Resource
+    private DeviceResponseEntityRepository deviceResponseEntityRepository;
+
+    @Resource
+    private DeviceIncidentReportRepository deviceIncidentReportRepository;
+
+    @Resource
+    private DeviceUpAndDownRepository deviceUpAndDownRepository;
+
+    @Override
+    public Map<String, Object> pageChange(Integer pageNum, Integer pageSize, String keyword) {
+        Map<String, Object> map = new HashMap<>(16);
+        if (keyword == null) {
+            keyword = "";
+        }
+        Long totalSize = deviceUpdataEntityRepository.count();
+        map.put("totalSize", totalSize);
+        map.put("totalPageNum", (totalSize + pageSize - 1) / pageSize);
+        Integer start = (pageNum - 1) * pageSize;
+        List<DeviceUpdataEntity> machineControlInfoList = deviceUpdataEntityRepository.getDeviceUpdataListByPage(start, pageSize, keyword);
+        map.put("data", machineControlInfoList);
+        return map;
+    }
+
+
+    @Override
+    public Map<String, Object> pageResponse(Integer pageNum, Integer pageSize, String keyword) {
+        Map<String, Object> map = new HashMap<>(16);
+        if (keyword == null) {
+            keyword = "";
+        }
+        Long totalSize = deviceResponseEntityRepository.count();
+        map.put("totalSize", totalSize);
+        map.put("totalPageNum", (totalSize + pageSize - 1) / pageSize);
+        Integer start = (pageNum - 1) * pageSize;
+        List<DeviceResponseEntity> machineControlInfoList = deviceResponseEntityRepository.getDeviceResponseListByPage(start, pageSize, keyword);
+        map.put("data", machineControlInfoList);
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> pageIncidentReport(Integer pageNum, Integer pageSize, String keyword) {
+        Map<String, Object> map = new HashMap<>(16);
+        if (keyword == null) {
+            keyword = "";
+        }
+        Long totalSize = deviceIncidentReportRepository.count();
+        map.put("totalSize", totalSize);
+        map.put("totalPageNum", (totalSize + pageSize - 1) / pageSize);
+        Integer start = (pageNum - 1) * pageSize;
+        List<DeviceIncidentReportEntity> machineControlInfoList = deviceIncidentReportRepository.getDeviceIncidentReportListByPage(start, pageSize, keyword);
+        map.put("data", machineControlInfoList);
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> pageUpAndDown(Integer pageNum, Integer pageSize, String keyword) {
+        Map<String, Object> map = new HashMap<>(16);
+        if (keyword == null) {
+            keyword = "";
+        }
+        Long totalSize = deviceUpAndDownRepository.count();
+        map.put("totalSize", totalSize);
+        map.put("totalPageNum", (totalSize + pageSize - 1) / pageSize);
+        Integer start = (pageNum - 1) * pageSize;
+        List<DeviceUpAndDownEntity> machineControlInfoList = deviceUpAndDownRepository.getDeviceUpAndDownListByPage(start, pageSize, keyword);
+        map.put("data", machineControlInfoList);
+        return map;
+    }
+}

+ 56 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/response/ErrorResponseData.java

@@ -0,0 +1,56 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+XiaoNuo采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改XiaoNuo源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/xiaonuo-vue
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/xiaonuo-vue
+6.若您的项目无法满足以上几点,可申请商业授权,获取XiaoNuo商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.devicedata.response;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 失败响应结果
+ *
+ * @author xuyuxiang
+ * @date 2020/3/30 15:05
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ErrorResponseData extends ResponseData {
+
+    /**
+     * 异常的具体类名称
+     */
+    private String exceptionClazz;
+
+    ErrorResponseData(String message) {
+        super(false, DEFAULT_ERROR_CODE, message, null);
+    }
+
+    public ErrorResponseData(Integer code, String message) {
+        super(false, code, message, null);
+    }
+
+    ErrorResponseData(Integer code, String message, Object object) {
+        super(false, code, message, object);
+    }
+}

+ 99 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/response/ResponseData.java

@@ -0,0 +1,99 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+XiaoNuo采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改XiaoNuo源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/xiaonuo-vue
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/xiaonuo-vue
+6.若您的项目无法满足以上几点,可申请商业授权,获取XiaoNuo商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.devicedata.response;
+
+import lombok.Data;
+
+/**
+ * 响应结果数据
+ *
+ * @author xuyuxiang
+ * @date 2020/3/30 15:04
+ */
+@Data
+public class ResponseData {
+
+    public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功";
+
+    public static final String DEFAULT_ERROR_MESSAGE = "网络异常";
+
+    public static final Integer DEFAULT_SUCCESS_CODE = 200;
+
+    public static final Integer DEFAULT_ERROR_CODE = 500;
+
+    /**
+     * 请求是否成功
+     */
+    private Boolean success;
+
+    /**
+     * 响应状态码
+     */
+    private Integer code;
+
+    /**
+     * 响应信息
+     */
+    private String message;
+
+    /**
+     * 响应对象
+     */
+    private Object data;
+
+    public ResponseData() {
+    }
+
+    public ResponseData(Boolean success, Integer code, String message, Object data) {
+        this.success = success;
+        this.code = code;
+        this.message = message;
+        this.data = data;
+    }
+
+    public static SuccessResponseData success() {
+        return new SuccessResponseData();
+    }
+
+    public static SuccessResponseData success(Object object) {
+        return new SuccessResponseData(object);
+    }
+
+    public static SuccessResponseData success(Integer code, String message, Object object) {
+        return new SuccessResponseData(code, message, object);
+    }
+
+    public static ErrorResponseData error(String message) {
+        return new ErrorResponseData(message);
+    }
+
+    public static ErrorResponseData error(Integer code, String message) {
+        return new ErrorResponseData(code, message);
+    }
+
+    public static ErrorResponseData error(Integer code, String message, Object object) {
+        return new ErrorResponseData(code, message, object);
+    }
+}

+ 46 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/response/SuccessResponseData.java

@@ -0,0 +1,46 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+XiaoNuo采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改XiaoNuo源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/xiaonuo-vue
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/xiaonuo-vue
+6.若您的项目无法满足以上几点,可申请商业授权,获取XiaoNuo商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.devicedata.response;
+
+/**
+ * 成功响应结果
+ *
+ * @author xuyuxiang
+ * @date 2020/3/30 15:04
+ */
+public class SuccessResponseData extends ResponseData {
+
+    public SuccessResponseData() {
+        super(true, DEFAULT_SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, null);
+    }
+
+    public SuccessResponseData(Object object) {
+        super(true, DEFAULT_SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, object);
+    }
+
+    public SuccessResponseData(Integer code, String message, Object object) {
+        super(true, code, message, object);
+    }
+}

+ 48 - 0
huimv-test-platform/huimv-ctwing-manage/src/main/java/com/huimv/devicedata/util/ResponseUtil.java

@@ -0,0 +1,48 @@
+package com.huimv.devicedata.util;
+
+import cn.hutool.core.util.CharsetUtil;
+import cn.hutool.http.ContentType;
+import com.alibaba.fastjson.JSON;
+import com.huimv.devicedata.response.ErrorResponseData;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 响应工具类
+ *
+ * @author xuyuxiang
+ * @date 2020/3/20 11:17
+ */
+public class ResponseUtil {
+
+    /**
+     * 响应异常,直接向前端写response,用于异常处理器捕获不到时手动抛出
+     *
+     * @author xuyuxiang
+     * @date 2020/3/20 11:18
+     */
+    public static void responseExceptionError(HttpServletResponse response,
+                                              Integer code,
+                                              String message,
+                                              String exceptionClazz) throws IOException {
+        response.setCharacterEncoding(CharsetUtil.UTF_8);
+        response.setContentType(ContentType.JSON.toString());
+        ErrorResponseData errorResponseData = new ErrorResponseData(code, message);
+        errorResponseData.setExceptionClazz(exceptionClazz);
+        String errorResponseJsonData = JSON.toJSONString(errorResponseData);
+        response.getWriter().write(errorResponseJsonData);
+    }
+
+    /**
+     * 响应异常,向前端返回ErrorResponseData的json数据,用于全局异常处理器
+     *
+     * @author xuyuxiang
+     * @date 2020/3/20 11:31
+     */
+    public static ErrorResponseData responseDataError(Integer code, String message, String exceptionClazz) {
+        ErrorResponseData errorResponseData = new ErrorResponseData(code, message);
+        errorResponseData.setExceptionClazz(exceptionClazz);
+        return errorResponseData;
+    }
+}