Bläddra i källkod

上海工行-金桥

shiwn 2 år sedan
förälder
incheckning
c27ceb4abe
57 ändrade filer med 3792 tillägg och 1 borttagningar
  1. 92 1
      code/h5client-app/pom.xml
  2. 3 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/H5clientAppApplication.java
  3. 429 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/RobotData.java
  4. 30 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/CheckPointDTO.java
  5. 75 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/CheckTaskDTO.java
  6. 73 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/EnvDataDTO.java
  7. 60 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/EnvSettingDTO.java
  8. 32 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/RobotDTO.java
  9. 27 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/RobotMapDTO.java
  10. 77 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/RobotSettingDTO.java
  11. 30 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/RobotWarningDTO.java
  12. 87 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/TaskDataDTO.java
  13. 31 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/TaskReportDTO.java
  14. 28 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/AlarmResultVO.java
  15. 22 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/GhCurrentTaskVO.java
  16. 33 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/GhEnvDataVO.java
  17. 47 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/GhRobotStatusVO.java
  18. 14 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/GhRobotVO.java
  19. 27 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/RedisKey.java
  20. 127 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/ResultData.java
  21. 45 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/enumData/AlarmLevelEnum.java
  22. 43 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/enumData/EnvTypeEnum.java
  23. 46 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/enumData/TaskStatusEnum.java
  24. 47 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/ACAFilter.java
  25. 60 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/DruidConfig.java
  26. 17 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/MybatisPlusConfig.java
  27. 68 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/RedisConfig.java
  28. 65 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/Swagger2.java
  29. 23 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/CheckPointMapper.java
  30. 37 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/CheckTaskMapper.java
  31. 23 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/EnvDataMapper.java
  32. 10 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/EnvSettingMapper.java
  33. 17 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/RobotMapMapper.java
  34. 22 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/RobotMapper.java
  35. 23 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/RobotSettingMapper.java
  36. 21 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/RobotWarningMapper.java
  37. 23 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/TaskDataMapper.java
  38. 23 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/TaskReportMapper.java
  39. 31 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/exception/BusinessException.java
  40. 103 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/exception/ControllerAdviceHandle.java
  41. 153 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/exception/ErrorCode.java
  42. 17 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/EnvSettingService.java
  43. 169 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/EnvSettingServiceImpl.java
  44. 20 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/GhH5Service.java
  45. 417 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/GhH5ServiceImpl.java
  46. 10 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/MapService.java
  47. 20 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/MapServiceImpl.java
  48. 8 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/RobotWarningService.java
  49. 38 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/RobotWarningServiceImpl.java
  50. 553 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/util/RedisUtils.java
  51. 38 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/web/GhH5Api.java
  52. 42 0
      code/h5client-app/src/main/java/com/gonghang/h5clientapp/web/GhH5Controller.java
  53. 53 0
      code/h5client-app/src/main/resources/application-dev.properties
  54. 52 0
      code/h5client-app/src/main/resources/application-prod.properties
  55. 51 0
      code/h5client-app/src/main/resources/application.properties
  56. 31 0
      code/h5client-app/src/main/resources/mapper/CheckTaskMapper.xml
  57. 29 0
      code/h5client-app/src/main/resources/mapper/TaskReportMapper.xml

+ 92 - 1
code/h5client-app/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.7.1</version>
+        <version>2.4.5</version>
         <relativePath/> <!-- lookup parent from repository -->
     </parent>
     <groupId>com.gonghang</groupId>
@@ -15,6 +15,7 @@
     <description>Demo project for Spring Boot</description>
     <properties>
         <java.version>1.8</java.version>
+        <tomcat.version>9.0.64</tomcat.version>
     </properties>
     <dependencies>
         <dependency>
@@ -43,6 +44,96 @@
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
+        <!--数据库连接池-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.1.8</version>
+        </dependency>
+        <!--        Redis依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <!--        tomcat版本指定            -->
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-juli</artifactId>
+            <version>${tomcat.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-logging-juli</artifactId>
+            <version>8.5.2</version>
+        </dependency>
+        <!--        lombok-->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <!-- mybatis启动器-->
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+        <!--mybatis分页插件-->
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.4.1</version>
+        </dependency>
+        <!--        mybatis-plus-->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+
+        <!--swagger用于定义API文档  -->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <!--bootstrap ui下的swagger-->
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>swagger-bootstrap-ui</artifactId>
+            <version>1.9.6</version>
+        </dependency>
+        <!--日志框架,SpringBoot默认的日志系统logback-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-logging</artifactId>
+        </dependency>
+        <!-- redis依赖commons-pool 这个依赖一定要添加 -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+
+        <!-- 工具包-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-validation</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 3 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/H5clientAppApplication.java

@@ -1,8 +1,11 @@
 package com.gonghang.h5clientapp;
 
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.ServletComponentScan;
 
+@MapperScan(value = {"com.gonghang.h5clientapp.dao"}) // 扫描mapper
 @SpringBootApplication
 public class H5clientAppApplication {
 

+ 429 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/RobotData.java

@@ -0,0 +1,429 @@
+package com.gonghang.h5clientapp.beans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * Created by shiwn on 2022/8/3 15:24
+ */
+public class RobotData {
+
+    //实际,机器人坐标点
+    @JsonProperty(value = "pos_x")
+    private int posX;
+    @JsonProperty(value = "pos_y")
+    private int posY;
+    @JsonProperty(value = "pos_z")
+    private int posZ;
+
+    @JsonProperty(value = "ang_yaw")
+    private int angYaw;
+
+    @JsonProperty(value = "work_speed")
+    private int workSpeed;
+    @JsonProperty(value = "left_speed")
+    private int leftSpeed;
+    @JsonProperty(value = "right_speed")
+    private int rightSpeed;
+
+    private int pitch;//俯仰角度:云台 Y轴
+    private int yaw;  //旋转角度:云台 X轴
+    private int roll; //倾斜角度:云台 Z轴
+    @JsonProperty(value = "ptz_speed")
+    private int ptzSpeed;
+    private int ratio;
+    @JsonProperty(value = "focal_distance")
+    private int focalDistance;
+    private int diaphragm;
+    private int focusing;
+
+    /**   #0  待机(默认模式),1:开机(运行模式)
+     //    #2:休息模式
+     //    #3:自动巡检模式
+     //    #4:手动模式
+     //    #5:充电模式
+     //    #6:暂停模式
+     //    #7:故障检修状态
+     //    #8:遥控模式
+     //    #9: 紧急定位模式(半自动模式)*/
+    @JsonProperty(value = "work_status")
+    private int workStatus;
+
+    @JsonProperty(value = "work_temp")
+    private float workTemp;
+    @JsonProperty(value = "work_mile")
+    private float workMile;
+    @JsonProperty(value = "work_time")
+    private float workTime;
+    @JsonProperty(value = "point_count")
+    private int pointCount;
+    @JsonProperty(value = "bad_count")
+    private int badCount;
+
+    @JsonProperty(value = "wifi_com")  //无线通信
+    private byte wifiCom;
+    @JsonProperty(value = "system_com")//系统通信
+    private byte systemCom;
+    @JsonProperty(value = "camera_com")//高清摄像头通信
+    private byte cameraCom;
+    @JsonProperty(value = "infrared_com")//高清红外通信
+    private byte infraredCom;
+    @JsonProperty(value = "room_com")    //充电房通信
+    private byte roomCom;
+
+    private float cap;//电量(0.00%~100.00%)
+    private float temp;//温度
+    private float cur;//电流
+    private float vol;//电压
+    @JsonProperty(value = "charging_vol")//充电电压
+    private float chargingVol;
+    @JsonProperty(value = "charging_status")//充电状态,0未充电,1正在充电
+    private boolean chargingStatus;
+    private byte bal;//电池稳定性(不为零,即电池异常)
+
+    @JsonProperty(value = "open_camera")
+    private boolean openCamera;
+    @JsonProperty(value = "open_infrared")
+    private boolean openInfrared;
+    @JsonProperty(value = "open_wiper")
+    private boolean openWiper;
+    @JsonProperty(value = "open_light")
+    private boolean openLight;
+    @JsonProperty(value = "open_radar")
+    private boolean openRadar;
+    @JsonProperty(value = "open_room")
+    private boolean openRoom;
+    @JsonProperty(value = "open_robot")
+    private boolean openRobot;
+
+    @JsonProperty(value = "error_code")
+    private int errorCode;
+
+    public int getPosX() {
+        return posX;
+    }
+
+    public void setPosX(int posX) {
+        this.posX = posX;
+    }
+
+    public int getPosY() {
+        return posY;
+    }
+
+    public void setPosY(int posY) {
+        this.posY = posY;
+    }
+
+    public int getPosZ() {
+        return posZ;
+    }
+
+    public void setPosZ(int posZ) {
+        this.posZ = posZ;
+    }
+
+    public int getAngYaw() {
+        return angYaw;
+    }
+
+    public void setAngYaw(int angYaw) {
+        this.angYaw = angYaw;
+    }
+
+    public int getWorkSpeed() {
+        return workSpeed;
+    }
+
+    public void setWorkSpeed(int workSpeed) {
+        this.workSpeed = workSpeed;
+    }
+
+    public int getLeftSpeed() {
+        return leftSpeed;
+    }
+
+    public void setLeftSpeed(int leftSpeed) {
+        this.leftSpeed = leftSpeed;
+    }
+
+    public int getRightSpeed() {
+        return rightSpeed;
+    }
+
+    public void setRightSpeed(int rightSpeed) {
+        this.rightSpeed = rightSpeed;
+    }
+
+    public int getPitch() {
+        return pitch;
+    }
+
+    public void setPitch(int pitch) {
+        this.pitch = pitch;
+    }
+
+    public int getYaw() {
+        return yaw;
+    }
+
+    public void setYaw(int yaw) {
+        this.yaw = yaw;
+    }
+
+    public int getRoll() {
+        return roll;
+    }
+
+    public void setRoll(int roll) {
+        this.roll = roll;
+    }
+
+    public int getPtzSpeed() {
+        return ptzSpeed;
+    }
+
+    public void setPtzSpeed(int ptzSpeed) {
+        this.ptzSpeed = ptzSpeed;
+    }
+
+    public int getRatio() {
+        return ratio;
+    }
+
+    public void setRatio(int ratio) {
+        this.ratio = ratio;
+    }
+
+    public int getFocalDistance() {
+        return focalDistance;
+    }
+
+    public void setFocalDistance(int focalDistance) {
+        this.focalDistance = focalDistance;
+    }
+
+    public int getDiaphragm() {
+        return diaphragm;
+    }
+
+    public void setDiaphragm(int diaphragm) {
+        this.diaphragm = diaphragm;
+    }
+
+    public int getFocusing() {
+        return focusing;
+    }
+
+    public void setFocusing(int focusing) {
+        this.focusing = focusing;
+    }
+
+    public int getWorkStatus() {
+        return workStatus;
+    }
+
+    public void setWorkStatus(int workStatus) {
+        this.workStatus = workStatus;
+    }
+
+    public float getWorkTemp() {
+        return workTemp;
+    }
+
+    public void setWorkTemp(float workTemp) {
+        this.workTemp = workTemp;
+    }
+
+    public float getWorkMile() {
+        return workMile;
+    }
+
+    public void setWorkMile(float workMile) {
+        this.workMile = workMile;
+    }
+
+    public float getWorkTime() {
+        return workTime;
+    }
+
+    public void setWorkTime(float workTime) {
+        this.workTime = workTime;
+    }
+
+    public int getPointCount() {
+        return pointCount;
+    }
+
+    public void setPointCount(int pointCount) {
+        this.pointCount = pointCount;
+    }
+
+    public int getBadCount() {
+        return badCount;
+    }
+
+    public void setBadCount(int badCount) {
+        this.badCount = badCount;
+    }
+
+    public byte getWifiCom() {
+        return wifiCom;
+    }
+
+    public void setWifiCom(byte wifiCom) {
+        this.wifiCom = wifiCom;
+    }
+
+    public byte getSystemCom() {
+        return systemCom;
+    }
+
+    public void setSystemCom(byte systemCom) {
+        this.systemCom = systemCom;
+    }
+
+    public byte getCameraCom() {
+        return cameraCom;
+    }
+
+    public void setCameraCom(byte cameraCom) {
+        this.cameraCom = cameraCom;
+    }
+
+    public byte getInfraredCom() {
+        return infraredCom;
+    }
+
+    public void setInfraredCom(byte infraredCom) {
+        this.infraredCom = infraredCom;
+    }
+
+    public byte getRoomCom() {
+        return roomCom;
+    }
+
+    public void setRoomCom(byte roomCom) {
+        this.roomCom = roomCom;
+    }
+
+    public float getCap() {
+        return cap;
+    }
+
+    public void setCap(float cap) {
+        this.cap = cap;
+    }
+
+    public float getTemp() {
+        return temp;
+    }
+
+    public void setTemp(float temp) {
+        this.temp = temp;
+    }
+
+    public float getCur() {
+        return cur;
+    }
+
+    public void setCur(float cur) {
+        this.cur = cur;
+    }
+
+    public float getVol() {
+        return vol;
+    }
+
+    public void setVol(float vol) {
+        this.vol = vol;
+    }
+
+    public float getChargingVol() {
+        return chargingVol;
+    }
+
+    public void setChargingVol(float chargingVol) {
+        this.chargingVol = chargingVol;
+    }
+
+    public boolean isChargingStatus() {
+        return chargingStatus;
+    }
+
+    public void setChargingStatus(boolean chargingStatus) {
+        this.chargingStatus = chargingStatus;
+    }
+
+    public byte getBal() {
+        return bal;
+    }
+
+    public void setBal(byte bal) {
+        this.bal = bal;
+    }
+
+    public boolean isOpenCamera() {
+        return openCamera;
+    }
+
+    public void setOpenCamera(boolean openCamera) {
+        this.openCamera = openCamera;
+    }
+
+    public boolean isOpenInfrared() {
+        return openInfrared;
+    }
+
+    public void setOpenInfrared(boolean openInfrared) {
+        this.openInfrared = openInfrared;
+    }
+
+    public boolean isOpenWiper() {
+        return openWiper;
+    }
+
+    public void setOpenWiper(boolean openWiper) {
+        this.openWiper = openWiper;
+    }
+
+    public boolean isOpenLight() {
+        return openLight;
+    }
+
+    public void setOpenLight(boolean openLight) {
+        this.openLight = openLight;
+    }
+
+    public boolean isOpenRadar() {
+        return openRadar;
+    }
+
+    public void setOpenRadar(boolean openRadar) {
+        this.openRadar = openRadar;
+    }
+
+    public boolean isOpenRoom() {
+        return openRoom;
+    }
+
+    public void setOpenRoom(boolean openRoom) {
+        this.openRoom = openRoom;
+    }
+
+    public boolean isOpenRobot() {
+        return openRobot;
+    }
+
+    public void setOpenRobot(boolean openRobot) {
+        this.openRobot = openRobot;
+    }
+
+    public int getErrorCode() {
+        return errorCode;
+    }
+
+    public void setErrorCode(int errorCode) {
+        this.errorCode = errorCode;
+    }
+}

+ 30 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/CheckPointDTO.java

@@ -0,0 +1,30 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 巡检点信息
+ * Created by shiwn on 2021/5/18 15:57
+ */
+@Data
+@Accessors(chain = true)
+@TableName("check_point")
+public class CheckPointDTO {
+    private String uuid;
+    private Long id;
+    private String pointName;
+    private String unit;
+    private String position;
+    private Integer deviceId;
+    private String parameter;
+    private Integer deviceType;
+    private Integer identifyType;
+    private Integer saveType;
+    private Integer status;
+    private Integer robotId;
+    private Integer areaId;
+    private Integer company;
+
+}

+ 75 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/CheckTaskDTO.java

@@ -0,0 +1,75 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 任务信息
+ * Created by shiwn on 2021/6/2 14:20
+ */
+@Data
+@Accessors(chain = true)
+@TableName("check_task")
+public class CheckTaskDTO {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+    private Integer createUserId;
+    private Date createTime;
+    /**
+     *  任务名称,巡检类型 + 时间 + 序号
+     */
+    private String taskName;
+    private String description;
+    /**
+     * 巡检类型(1-全面,2-例行,3-专项,4-缺陷)
+     */
+    private Integer taskType;
+    /**
+     * 设备类型
+     */
+    private String deviceTypes;
+    /**
+     * 执行方式(立即0、定期1、周期2)
+     */
+    private Integer actType;
+    /**
+     * 巡检点
+     */
+    private String pointIds;
+    /**
+     * 任务下发时间
+     */
+    private Date sendTime;
+    /**
+     * 下发状态,0-未下发,1-已下发
+     */
+    private Integer isSend;
+    /**
+     * 定期任务执行时间
+     */
+    private String planTime;
+    /**
+     * 状态(0-等待执行,1-正在执行,2-执行中断,3-执行完毕,4-超期,5-暂停)
+     */
+    private Integer taskStatus;
+    /**
+     * 机器人id
+     */
+    private Integer robotId;
+
+    /**
+     * 第三方id(如国网协议id)
+     */
+    private String externalId;
+
+    @TableField(exist = false)
+    private String createUserName;
+    @TableField(exist = false)
+    private String robotName;
+}

+ 73 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/EnvDataDTO.java

@@ -0,0 +1,73 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 环境数据
+ * Created by shiwn on 2021/6/18 10:39
+ */
+@Data
+@Accessors(chain = true)
+@TableName("env_data")
+public class EnvDataDTO {
+    /**
+     * 主键,13位时间戳
+     */
+    private Long id;
+    /**
+     * 湿度
+     */
+    private Float humidity;
+    /**
+     * 温度
+     */
+    private Float temperature;
+    /**
+     * 风速
+     */
+    private Float windSpeed;
+    /**
+     * 风力
+     */
+    private Integer windPower;
+    /**
+     * 风向
+     */
+    private String windDirection;
+    /**
+     * 雨强
+     */
+    private Float raininess;
+    /**
+     * 气压
+     */
+    private Integer airPressure;
+    /**
+     * pm2.5浓度
+     */
+    private Float pm;
+    /**
+     * 天气状况
+     */
+    private Integer weather;
+    private Float co;
+    private Float co2;
+    private Float o3;
+    private Float o2;
+    private Float sf6;
+    /**
+     * 明火
+     */
+    private Float fire;
+    /**
+     * 烟雾
+     */
+    private Float mq;
+    /**
+     * 光强
+     */
+    private Float light;
+    private Integer robotId;
+}

+ 60 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/EnvSettingDTO.java

@@ -0,0 +1,60 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 环境阈值
+ *
+ * @author machao
+ * @version 1.0
+ * @date 2021/6/2 13:55
+ */
+@Data
+@TableName("env_setting")
+public class EnvSettingDTO {
+
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty(value = "环境指标类型(CO;CO2;SF6;O3;PM;TEMPERATURE;HUMIDITY)")
+    private String envType;
+
+    @ApiModelProperty(value = "环境名称(一氧化碳,二氧化碳,六氟化硫,臭氧,PM2.5,温度,湿度)")
+    private String envName;
+
+    @ApiModelProperty(value = "安全范围最大值")
+    private String safeMax;
+
+    @ApiModelProperty(value = "安全范围最小值")
+    private String safeMin;
+
+    @ApiModelProperty(value = "预警最大值1组")
+    private String earlyWarningMax1;
+
+    @ApiModelProperty(value = "预警最小值1组")
+    private String earlyWarningMin1;
+
+    @ApiModelProperty(value = "预警最大值2组")
+    private String earlyWarningMax2;
+
+    @ApiModelProperty(value = "预警最小值2组")
+    private String earlyWarningMin2;
+
+    @ApiModelProperty(value = "危急范围最大值")
+    private String seriousWarningMax;
+
+    @ApiModelProperty(value = "危急范围最小值")
+    private String seriousWarningMin;
+
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+    @ApiModelProperty(value = "更新人")
+    private Integer updateUserId;
+}

+ 32 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/RobotDTO.java

@@ -0,0 +1,32 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: 机器人信息
+ * @Author: shiwn
+ * @Date: 2021/5/18 15:58
+ */
+@Data
+@Accessors(chain = true)
+@TableName("robot")
+public class RobotDTO {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+    private String robotName;
+    private String robotNo;
+    private Integer type;
+    private String modelName;
+    private String ip;
+    private Integer port;
+    private Integer channelHd;
+    private Integer channelIr;
+    private Integer status;
+    private Integer selected;
+    private Integer company;
+    private String scene;
+}

+ 27 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/RobotMapDTO.java

@@ -0,0 +1,27 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 机器人地图信息
+ * Created by shiwn on 2021/5/19 14:03
+ */
+@Data
+@Accessors(chain = true)
+@TableName("robot_map")
+public class RobotMapDTO {
+    @TableId(value = "id",type = IdType.INPUT)
+    private Integer id;
+    private Long mapNo;
+    private Integer robotId;
+    private String mapImg;
+    private Integer height;
+    private Integer width;
+    private Float gridSize;
+    private String station;
+    private String endPoint;
+}

+ 77 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/RobotSettingDTO.java

@@ -0,0 +1,77 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 机器热参数
+ * Created by shiwn on 2021/6/17 10:54
+ */
+@Data
+@Accessors(chain = true)
+@TableName("robot_setting")
+public class RobotSettingDTO {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 自检方式:0-开机自检,1-巡检前自检,2-定时自检,3-手动自检,4-实时自检
+     */
+    private Integer checkType;
+
+    /**
+     * 自检时间间隔(小时)
+     */
+    private Integer checkValue;
+
+    /**
+     * 机器人行驶速度
+     */
+    private Float robotSpeed;
+
+    /**
+     * 前后雷达避障距离,米
+     */
+    private Float obsDisBafter;
+
+    /**
+     * 左右雷达避障距离,米
+     */
+    private Float obsDisLright;
+
+    /**
+     * 最低保护电量
+     */
+    private Integer batteryLow;
+
+    /**
+     * 电池温度报警值
+     */
+    private Integer batteryTemp;
+
+    /**
+     * 机身温度报警值
+     */
+    private Integer robotTemp;
+
+    /**
+     * 机器人id
+     */
+    private Integer robotId;
+
+    /**
+     * 云台初始位置——x
+     */
+    private Integer initX;
+    /**
+     * 云台初始位置——y
+     */
+    private Integer initY;
+    /**
+     * 云台初始位置——z
+     */
+    private Integer initZ;
+}

+ 30 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/RobotWarningDTO.java

@@ -0,0 +1,30 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 机器人自检告警信息
+ * Created by shiwn on 2021/5/20 11:48
+ */
+@Data
+@Accessors(chain = true)
+@TableName("robot_warning")
+public class RobotWarningDTO {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+    private Date createTime;
+    private String robotIp;
+    private Integer type;
+    private Date warningTime;
+    private String warningCode;
+    private String warningMsg;
+    private String codePartOne;
+    private String codePartTwo;
+    private String faultCode;
+}

+ 87 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/TaskDataDTO.java

@@ -0,0 +1,87 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+/**
+ * 任务执行数据
+ * Created by shiwn on 2021/6/2 14:21
+ */
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+@Data
+@Accessors(chain = true)
+@TableName("task_data")
+public class TaskDataDTO {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+    /**
+     * 任务id
+     */
+    private Integer taskId;
+    /**
+     * 周期循环次数
+     */
+    private int runTimes;
+    /**
+     * 开始时间
+     */
+    private Date startTime;
+    /**
+     * 结束时间
+     */
+    private Date endTime;
+
+    /**
+     * 巡检点总数
+     */
+    private Integer totalPointNum;
+    /**
+     * 已巡检点数
+     */
+    private Integer checkedPointNum;
+    /**
+     * 告警/异常点数
+     */
+    private Integer warningPointNum;
+    /**
+     * 告警/异常总数(新增字段)
+     */
+    private Integer totalWarningNum;
+    /**
+     * 识别异常点数
+     */
+    private Integer exceptionPointNum;
+    /**
+     * 识别异常总数
+     */
+    private Integer totalExceptionNum;
+    /**
+     * 未识别点数
+     */
+    private Integer unidentifyPointNum;
+    /**
+     * 巡检进度
+     */
+    private Integer taskProgress;
+    /**
+     * 预计巡检时间(分钟)
+     */
+    private Integer useTime;
+    /**
+     * 当前巡检点
+     */
+    private Long currentPoint;
+    /**
+     * 更新时间戳
+     */
+    private Long updateTime;
+    /**
+     * 规划线路
+     */
+    private String route;
+}

+ 31 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/dto/TaskReportDTO.java

@@ -0,0 +1,31 @@
+package com.gonghang.h5clientapp.beans.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 任务报告
+ * Created by shiwn on 2021/6/3 15:02
+ */
+@Data
+@Accessors(chain = true)
+@TableName("task_report")
+public class TaskReportDTO {
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+    private Date createTime;
+    private Integer taskId;
+    private Integer runTimes;
+    private String reportName;
+    private String filePath;
+    /**
+     * 生成状态,1-已生成,0-未生成
+     */
+    private Integer status;
+
+}

+ 28 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/AlarmResultVO.java

@@ -0,0 +1,28 @@
+package com.gonghang.h5clientapp.beans.vo;
+
+import lombok.Data;
+
+/**
+ * @author machao
+ * @version 1.0
+ * @description: 告警判定结果
+ * @date 2021/7/1 9:38
+ */
+@Data
+public class AlarmResultVO {
+
+    //目标id
+    private Long targetId;
+
+    //告警对象
+    private String alarmFor;
+
+    //告警类型
+    private String alarmLevel;
+
+    //识别数据
+    private String discernResult;
+
+    //数据id
+    private Long dataId;
+}

+ 22 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/GhCurrentTaskVO.java

@@ -0,0 +1,22 @@
+package com.gonghang.h5clientapp.beans.vo;
+
+import lombok.Data;
+
+/**
+ * 上海工商银行对接 —— 实时任务数据
+ * Created by shiwn on 2022/7/5 13:36
+ */
+@Data
+public class GhCurrentTaskVO {
+    private String taskName;
+    private Integer taskStatus;
+    private String pointName;
+    private Integer useTime;
+    private Integer taskProgress;
+
+    private Integer totalPointNum;
+    private Integer normalPointNum;
+    private Integer checkedPointNum;
+    private Integer notCheckedPointNum;
+    private Integer errorPointNum;
+}

+ 33 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/GhEnvDataVO.java

@@ -0,0 +1,33 @@
+package com.gonghang.h5clientapp.beans.vo;
+
+import lombok.Data;
+
+/**
+ * 上海工商银行对接 —— 环境数据
+ * Created by shiwn on 2022/7/5 9:33
+ */
+@Data
+public class GhEnvDataVO {
+    private Float humidity;
+    private Boolean checkHumidity;
+
+    private Float temperature;
+    private Boolean checkTemperature;
+
+    private Float co;
+    private Boolean checkCo;
+
+    private Float co2;
+    private Boolean checkCo2;
+
+    private Float sf6;
+    private Boolean checkSf6;
+
+    private Float o3;
+    private Boolean checkO3;
+
+
+    private String mq = "无";
+    private String fire = "无";
+    private String airQuality = "无";
+}

+ 47 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/GhRobotStatusVO.java

@@ -0,0 +1,47 @@
+package com.gonghang.h5clientapp.beans.vo;
+
+import lombok.Data;
+
+/**
+ * 上海工商银行对接 —— 机器人实时状态数据
+ * Created by shiwn on 2022/7/5 9:18
+ */
+@Data
+public class GhRobotStatusVO {
+    /**
+     * 通讯状态。1-在线,0-离线
+     */
+    private byte systemCom = 0;
+    /**
+     * 电量
+     */
+    private Float cap;
+    private Boolean checkCap = false;
+    /**
+     * 电池温度
+     */
+    private Float temp;
+    private Boolean checkTemp = false;
+    /**
+     * 机身温度
+     */
+    private Float workTemp;
+    private Boolean checkWorkTemp = false;
+    /**
+     * 充电状态.true-充电,false-不在充电
+     */
+    private Boolean chargingStatus;
+    /**
+     * 前方是否障碍.true-是,false-否
+     */
+    private Boolean openRadar;
+    /**
+     * 地图上坐标
+     */
+    private Integer mapX;
+    private Integer mapY;
+    /**
+     * 是否自检告警.true-是,false-否
+     */
+    private Boolean robotCheck;
+}

+ 14 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/beans/vo/GhRobotVO.java

@@ -0,0 +1,14 @@
+package com.gonghang.h5clientapp.beans.vo;
+
+import lombok.Data;
+
+/**
+ * 上海工商银行对接 —— 机器人数据
+ * Created by shiwn on 2022/7/5 9:11
+ */
+@Data
+public class GhRobotVO {
+    private String robotName;
+    private String robotIp;
+    private Integer robotId;
+}

+ 27 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/RedisKey.java

@@ -0,0 +1,27 @@
+package com.gonghang.h5clientapp.common;
+
+/**
+ * Redis Key 常量共用类
+ */
+public class RedisKey {
+
+    /**
+     * 机器人实时数据
+     **/
+    public static final String ROBOT_DATA = "robot_data_";
+
+    /**
+     * 机器人实时地图数据
+     **/
+    public static final String MAP_DATA = "map_data_";
+
+    /**
+     * 当前选择的机器人
+     **/
+    public static final String SELECTED_ROBOT = "selected_robot";
+
+    /**
+     * 全部机器人列表
+     **/
+    public static final String ROBOT_LIST = "robot_list";
+}

+ 127 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/ResultData.java

@@ -0,0 +1,127 @@
+package com.gonghang.h5clientapp.common;
+
+
+import com.gonghang.h5clientapp.exception.ErrorCode;
+
+/**
+ * Created by shiwn on 2021-05-08
+ */
+public class ResultData<T> {
+
+    /**
+     * 默认:0成功,1失败,205结果为null,500系统异常
+     */
+    private Integer code;
+    private String msg;
+    private T data;
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public T getData() {
+        return data;
+    }
+
+    public void setData(T data) {
+        this.data = data;
+    }
+
+    public ResultData() {
+        this.code = 0;
+        this.msg = "操作成功";
+    }
+
+    public ResultData(Integer code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public ResultData(Integer code, T obj) {
+        this.code = code;
+        this.data = obj;
+    }
+
+    private ResultData(T data) {
+        this.code = 0;
+        this.msg = "操作成功";
+        this.data = data;
+    }
+
+    private ResultData(ErrorCode data) {
+        this.code = data.getCode();
+        this.msg = data.getMsg();
+        this.data = null;
+    }
+
+    /**
+     * 操作成功,无返回数据
+     *
+     * @return 0
+     */
+    public static ResultData success() {
+        return new ResultData();
+    }
+
+    /**
+     * @Description: 操作执行成功,并判断返回值
+     * @Param: [data]
+     * @Author: shiwn
+     * @Date: 2020/8/3 15:56
+     */
+    public static ResultData success(Object data) {
+        //  判断空值
+        if (data != null) {
+            return new ResultData(data);
+        } else {
+            return ResultData.emptyData();
+        }
+    }
+
+
+    /**
+     * 操作失败
+     *
+     * @param code code
+     * @param msg  操作信息
+     * @return ResultData
+     */
+    public static ResultData fail(Integer code, String msg) {
+        return new ResultData(code, msg);
+    }
+
+    /**
+     * @Description: 操作成功,但返回值为null
+     * @Param: [data]
+     * @Author: shiwn
+     * @Date: 2020/8/3 15:57
+     */
+    public static ResultData emptyData() {
+        return new ResultData(205, "查询结果为空");
+    }
+
+    public static ResultData fail(String msg) {
+        return new ResultData(1, msg);
+    }
+
+    public static ResultData fail(ErrorCode errorCode) {
+        return new ResultData(errorCode);
+    }
+
+    public static ResultData fail() {
+        return new ResultData(1, "操作失败");
+    }
+
+}

+ 45 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/enumData/AlarmLevelEnum.java

@@ -0,0 +1,45 @@
+package com.gonghang.h5clientapp.common.enumData;
+
+/**
+ * 告警等级
+ * Created by shiwn on 2021/6/23 15:24
+ */
+public enum AlarmLevelEnum {
+    NORMAL(0, "正常"),
+    TYPE_1(1, "预警"),
+    TYPE_2(2, "一般告警"),
+    TYPE_3(3, "严重告警"),
+    TYPE_4(4, "危急告警");
+
+    private int code;
+    private String msg;
+
+    AlarmLevelEnum(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    /**
+     * @Description: 根据code取msg
+     * @Date: 2021/6/24 15:18
+     * @Author: shiwn
+     * @Param: [code]
+     * @Return:
+     */
+    public static String getMsg(int code) {
+        for (AlarmLevelEnum c : AlarmLevelEnum.values()) {
+            if (c.getCode() == code) {
+                return c.msg;
+            }
+        }
+        return null;
+    }
+}

+ 43 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/enumData/EnvTypeEnum.java

@@ -0,0 +1,43 @@
+package com.gonghang.h5clientapp.common.enumData;
+
+/**
+ * 环境类型枚举
+ *
+ * @author machao
+ * @version 1.0
+ * @date 2021/6/2 15:35
+ */
+public enum EnvTypeEnum {
+    CO("CO", "一氧化碳"),
+
+    CO2("CO2", "二氧化碳"),
+
+    SF6("SF6", "六氟化硫"),
+
+    O3("O3", "臭氧"),
+
+    PM("pm2.5", "pm2.5"),
+
+    TEMPERATURE("TEMPERATURE", "温度"),
+
+    HUMIDITY("HUMIDITY", "湿度");
+
+
+    private String index;
+
+    private String name;
+
+    EnvTypeEnum(String index, String name) {
+        this.index = index;
+        this.name = name;
+    }
+
+    public String getIndex() {
+        return index;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+}

+ 46 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/common/enumData/TaskStatusEnum.java

@@ -0,0 +1,46 @@
+package com.gonghang.h5clientapp.common.enumData;
+
+/**
+ * 任务状态
+ * Created by shiwn on 2021/6/10 14:19
+ */
+public enum TaskStatusEnum {
+    WAITING(0, "等待"),
+    WORKING(1, "正在执行"),
+    BREAKED(2, "终止"),
+    FINISHED(3, "执行完毕"),
+    TIMEOUT(4, "超时"),
+    SUSPEND(5, "暂停");
+
+    private int code;
+    private String msg;
+
+    TaskStatusEnum(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    /**
+     * @Description: 根据code取msg
+     * @Date: 2021/6/24 15:18
+     * @Author: shiwn
+     * @Param: [code]
+     * @Return:
+     */
+    public static String getMsg(int code) {
+        for (TaskStatusEnum c : TaskStatusEnum.values()) {
+            if (c.getCode() == code) {
+                return c.msg;
+            }
+        }
+        return null;
+    }
+}

+ 47 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/ACAFilter.java

@@ -0,0 +1,47 @@
+package com.gonghang.h5clientapp.config;
+
+import org.springframework.stereotype.Component;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 跨域的设置问题
+ * Created by shiwn on 2021-01-14.
+ */
+@Component
+public class ACAFilter implements Filter {
+
+
+    /**
+     * 初始化
+     */
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+    }
+
+    /**
+     * 过滤器配置参数
+     */
+    @Override
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+        HttpServletResponse response = (HttpServletResponse) servletResponse;
+        HttpServletRequest request = (HttpServletRequest) servletRequest;
+        response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
+        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+        response.setHeader("Access-Control-Max-Age", "3600");
+        response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
+        response.setHeader("Access-Control-Allow-Credentials", "true");
+        //System.out.println("*********************************过滤器被使用**************************");
+        filterChain.doFilter(servletRequest, servletResponse);
+    }
+
+    /**
+     * 销毁
+     */
+    @Override
+    public void destroy() {
+    }
+}

+ 60 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/DruidConfig.java

@@ -0,0 +1,60 @@
+package com.gonghang.h5clientapp.config;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import com.alibaba.druid.support.http.StatViewServlet;
+import com.alibaba.druid.support.http.WebStatFilter;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.sql.DataSource;
+
+/**
+ * 访问地址:http://localhost:8089/druid/login.html
+ * Updated by shiwn on 2021/11/22 10:19
+ */
+@Configuration
+public class DruidConfig {
+    /**
+     * 将所有前缀为spring.datasource下的配置项都加载DataSource中
+     */
+    @Bean
+    @ConfigurationProperties(prefix = "spring.datasource")
+    public DataSource druid() {
+        return new DruidDataSource();
+    }
+
+    //  配置druid的监控
+    @Bean
+    public ServletRegistrationBean registrationBean() {
+        ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
+        // 白名单,默认是允许所有的访问
+        registrationBean.addInitParameter("allow", "localhost");
+        // 黑名单
+        registrationBean.addInitParameter("deny", "");
+        // 用户名
+        registrationBean.addInitParameter("loginUsername", "admin");
+        // 密码
+        registrationBean.addInitParameter("loginPassword", "123456");
+        // 是否可以重置数据源
+        registrationBean.addInitParameter("resetEnable", "false");
+        return registrationBean;
+    }
+
+
+    /**
+     * 配置监控的filter
+     */
+    @Bean
+    public FilterRegistrationBean webStatFilter() {
+        FilterRegistrationBean bean = new FilterRegistrationBean();
+        bean.setFilter(new WebStatFilter());
+        // 所有请求进行监控处理
+        bean.addUrlPatterns("/*");
+        // 排除名单
+        bean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
+        return bean;
+    }
+}

+ 17 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/MybatisPlusConfig.java

@@ -0,0 +1,17 @@
+package com.gonghang.h5clientapp.config;
+
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * MybatisPlus分页配置
+ * Created by shiwn on 2021/5/10 16:43
+ */
+@Configuration
+public class MybatisPlusConfig {
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        return new PaginationInterceptor();
+    }
+}

+ 68 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/RedisConfig.java

@@ -0,0 +1,68 @@
+package com.gonghang.h5clientapp.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+import java.net.UnknownHostException;
+
+/**
+ * Redis配置类
+ * Created by shiwn on 2021/5/11 10:41
+ */
+@Configuration
+public class RedisConfig {
+
+    @Bean
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) throws UnknownHostException {
+        RedisTemplate<String, Object> template = new RedisTemplate<>();
+        template.setConnectionFactory(redisConnectionFactory);
+        setRedisTemplate(template);
+        template.afterPropertiesSet();
+        return template;
+    }
+
+    /**
+     * @Description: 序列化
+     * @Param: [template] 
+     * @Author: shiwn 
+     * @Date: 2021/5/11 11:28
+     */ 
+    private void setRedisTemplate(RedisTemplate<String, Object> template) {
+        // Json序列化配置
+        Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
+
+        ObjectMapper objectMapper = new ObjectMapper();
+        objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+        // 解决jackson2无法反序列化LocalDateTime的问题
+        objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+        objectMapper.registerModule(new JavaTimeModule());
+
+        objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
+        jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
+
+        // String 的序列化
+        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
+        // key采用String的序列化方式
+        template.setKeySerializer(stringRedisSerializer);
+        // hash的key也采用String的序列化方式
+        template.setHashKeySerializer(stringRedisSerializer);
+        // value序列化方式采用jackson
+        template.setValueSerializer(jackson2JsonRedisSerializer);
+        // hash的value序列化方式采用jackson
+        template.setHashValueSerializer(jackson2JsonRedisSerializer);
+        // 设置值(value)的序列化采用FastJsonRedisSerializer。
+        // 设置键(key)的序列化采用StringRedisSerializer。
+        template.afterPropertiesSet();
+    }
+}

+ 65 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/config/Swagger2.java

@@ -0,0 +1,65 @@
+package com.gonghang.h5clientapp.config;
+
+import com.google.common.base.Predicate;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.RequestHandler;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+
+/**
+ * swagger文档配置
+ *
+ * 访问地址:http://localhost:8089/swagger-ui.html
+ * 优化后地址:http://localhost:8089/doc.html
+ *
+ * 参照:https://www.jianshu.com/p/7e543f0f0bd8
+ *
+ */
+@Configuration
+@EnableSwagger2
+public class Swagger2 {
+
+	@Bean
+    public Docket createRestApi() {
+        return new Docket(DocumentationType.SWAGGER_2)
+                .apiInfo(apiInfo())
+                .select()
+                .apis(basePackage("com.gonghang.h5clientapp.web"))
+                .build();
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder()
+                .title("掌上运维")
+                .description("掌上运维-doc")
+                .termsOfServiceUrl("http://localhost:8089/doc.html")
+                .version("1.0")
+                .build();
+    }
+
+    // 定义分隔符
+    private static final String splitor = ";";
+
+    private static Predicate<RequestHandler> basePackage(final String basePackage) {
+        return input -> {
+            // 循环判断匹配
+            for (String everyPackage : basePackage.split(splitor)) {
+                boolean isMatch = declaringClass(input).getPackage().getName().startsWith(everyPackage);
+                if (isMatch) {
+                    return true;
+                }
+            }
+            return false;
+        };
+    }
+
+    private static Class<?> declaringClass(RequestHandler input) {
+        return input.getHandlerMethod().getMethod().getDeclaringClass();
+    }
+
+}

+ 23 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/CheckPointMapper.java

@@ -0,0 +1,23 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.CheckPointDTO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2022/8/3 15:39
+ */
+@Component
+public interface CheckPointMapper extends BaseMapper<CheckPointDTO> {
+    /**
+     * @Description: 查询 by 巡检点id
+     * @Date: 2021/6/10 14:18
+     * @Author: shiwn
+     * @Param: [pointId]
+     * @Return:
+     */
+    @Select("select * from check_point where id = #{pointId}")
+    CheckPointDTO selectByPointId(@Param("pointId") Long pointId);
+}

+ 37 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/CheckTaskMapper.java

@@ -0,0 +1,37 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.CheckTaskDTO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by shiwn on 2022/8/3 15:33
+ */
+@Component
+public interface CheckTaskMapper extends BaseMapper<CheckTaskDTO> {
+    /**
+     * @Description: 查询最新状态的任务
+     * @Date: 2021/6/30 15:50
+     * @Author: shiwn
+     * @Param: taskStatus:状态(等待执行0、正在执行1、执行中断2、执行完毕3、超期4、暂停5)
+     * @Return:
+     */
+    @Select("select * from check_task where task_status = #{taskStatus} and robot_id = #{robotId} order by id desc limit 1")
+    CheckTaskDTO selectByTaskStatus(@Param("robotId") Integer robotId, @Param("taskStatus") Integer taskStatus);
+
+    @Select("select * from check_task where robot_id = #{robotId} order by id desc limit 1")
+    CheckTaskDTO selectNewByRobotId(@Param("robotId") Integer robotId);
+
+    /**
+     * @Description: 上海工行 掌上运维——查询任务列表
+     * @Author: shiwn
+     * @Param: [robotId]
+     * @Return:
+     */
+    List<Map> selectTaskList(@Param("robotId") Integer robotId);
+}

+ 23 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/EnvDataMapper.java

@@ -0,0 +1,23 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.EnvDataDTO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2022/8/3 14:23
+ */
+@Component
+public interface EnvDataMapper extends BaseMapper<EnvDataDTO> {
+    /**
+     * @Description: 获取最新的一条数据记录 by 机器人id
+     * @Date: 2022/7/5 9:31
+     * @Author: shiwn
+     * @Param: [robotId]
+     * @Return:
+     */
+    @Select("select * from env_data where robot_id =#{robotId} order by id desc LIMIT 0,1")
+    EnvDataDTO selectByRobotId(@Param("robotId") Integer robotId);
+}

+ 10 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/EnvSettingMapper.java

@@ -0,0 +1,10 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.EnvSettingDTO;
+
+/**
+ * Created by shiwn on 2022/8/3 14:24
+ */
+public interface EnvSettingMapper extends BaseMapper<EnvSettingDTO> {
+}

+ 17 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/RobotMapMapper.java

@@ -0,0 +1,17 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.RobotMapDTO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2022/8/3 15:49
+ */
+@Component
+public interface RobotMapMapper extends BaseMapper<RobotMapDTO> {
+
+    @Select("SELECT * FROM robot_map WHERE robot_id=#{robotId} ORDER BY id DESC LIMIT 1")
+    RobotMapDTO selectMapByRobotId(@Param("robotId") int robotId);
+}

+ 22 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/RobotMapper.java

@@ -0,0 +1,22 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.RobotDTO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * Created by shiwn on 2022/8/3 14:18
+ */
+@Component
+public interface RobotMapper extends BaseMapper<RobotDTO> {
+
+    @Select("SELECT * FROM robot ORDER BY id DESC")
+    List<RobotDTO> queryAllRobots();
+
+    @Select("SELECT * FROM robot WHERE ip = #{ip}")
+    RobotDTO selectRobotByIP(@Param("ip") String ip);
+}

+ 23 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/RobotSettingMapper.java

@@ -0,0 +1,23 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.RobotSettingDTO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2022/8/3 15:57
+ */
+@Component
+public interface RobotSettingMapper extends BaseMapper<RobotSettingDTO> {
+    /**
+     * @Description: 查询 by 机器人id
+     * @Date: 2021/6/17 14:48
+     * @Author: shiwn
+     * @Param: [robotIp]
+     * @Return:
+     */
+    @Select("select * from robot_setting where robot_id =#{robotId}")
+    RobotSettingDTO selectByRobotId(@Param("robotId") Integer robotId);
+}

+ 21 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/RobotWarningMapper.java

@@ -0,0 +1,21 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.RobotWarningDTO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2022/8/3 15:45
+ */
+@Component
+public interface RobotWarningMapper extends BaseMapper<RobotWarningDTO> {
+    /**
+     * @Description: 获取最新的一条机器人故障告警
+     * @Author: shiwn
+     * @Date: 2021/1/28 18:03
+     */
+    @Select("select * from robot_warning where robot_ip=#{robotIp} order by create_time desc limit 0,1")
+    RobotWarningDTO selectNewOne(@Param("robotIp") String robotIp);
+}

+ 23 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/TaskDataMapper.java

@@ -0,0 +1,23 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.TaskDataDTO;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2022/8/3 15:31
+ */
+@Component
+public interface TaskDataMapper extends BaseMapper<TaskDataDTO> {
+    /**
+     * @Description: 查询最新周期数据 by 任务id
+     * @Date: 2021/6/3 16:54
+     * @Author: shiwn
+     * @Param: [taskId]
+     * @Return:
+     */
+    @Select("select * from task_data where task_id = #{taskId} and run_times = (select max(run_times) from task_data where task_id = #{taskId})")
+    TaskDataDTO selectCurrentTask(@Param("taskId") Integer taskId);
+}

+ 23 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/dao/TaskReportMapper.java

@@ -0,0 +1,23 @@
+package com.gonghang.h5clientapp.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gonghang.h5clientapp.beans.dto.TaskReportDTO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by shiwn on 2022/8/4 10:24
+ */
+@Component
+public interface TaskReportMapper extends BaseMapper<TaskReportDTO> {
+    /**
+     * @Description: 上海工行 掌上运维——查询报告列表
+     * @Author: shiwn
+     * @Param: [robotId]
+     * @Return:
+     */
+    List<Map> selectReportList(@Param("robotId") Integer robotId);
+}

+ 31 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/exception/BusinessException.java

@@ -0,0 +1,31 @@
+package com.gonghang.h5clientapp.exception;
+
+/**
+ * @Description: 自定义异常类
+ * @Author: shiwn
+ * @Date: 2020/1/17 11:13
+ */
+public final class BusinessException extends RuntimeException {
+
+    private int code;
+
+    public BusinessException(int exceptionCode, String message, Throwable clause) {
+        super(message, clause);
+        code = exceptionCode;
+    }
+
+    public BusinessException(int exceptionCode, String message) {
+        super(message);
+
+        code = exceptionCode;
+    }
+
+    public BusinessException(ErrorCode errorCode) {
+        super(errorCode.getMsg());
+        code = errorCode.getCode();
+    }
+
+    public final int getCode() {
+        return code;
+    }
+}

+ 103 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/exception/ControllerAdviceHandle.java

@@ -0,0 +1,103 @@
+package com.gonghang.h5clientapp.exception;
+
+import com.gonghang.h5clientapp.common.ResultData;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import javax.validation.ValidationException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 自定义异常处理
+ * @Author: shiwn
+ * @Date: 2020/1/17 11:19
+ */
+@RestController
+@ControllerAdvice
+public class ControllerAdviceHandle {
+
+    /**
+     * @Description: 处理自定义异常
+     * @Param: [request, e]
+     * @Author: shiwn
+     * @Date: 2020/1/17 11:36
+     */
+    @ExceptionHandler({BusinessException.class})
+    public ResultData businessExceptionHandler(BusinessException e) throws BusinessException {
+        return ResultData.fail(e.getCode(), e.getMessage());
+    }
+
+    /**
+     * @Description: 处理全局异常
+     * @Param: [request, e]
+     * @Author: shiwn
+     * @Date: 2020/1/17 11:36
+     */
+    @ExceptionHandler(value = Exception.class)
+    public ResultData handleException(Exception e) throws Exception {
+        return ResultData.fail(e.getMessage());
+    }
+
+
+    // 新增如下代码:[捕获全局 参数校验异常 配合Valid使用]
+
+    /**
+     * 处理所有校验失败的异常(MethodArgumentNotValidException异常)
+     *
+     * @param ex
+     * @return
+     */
+    @ExceptionHandler(value = MethodArgumentNotValidException.class)
+    @ResponseStatus(HttpStatus.BAD_REQUEST)
+    public ResultData handleBindGetException(MethodArgumentNotValidException ex) {
+        // 获取所有异常
+        List<String> errors = ex.getBindingResult()
+                .getFieldErrors()
+                .stream()
+                .map(x -> x.getDefaultMessage())
+                .collect(Collectors.toList());
+        return ResultData.fail(1, String.join(",", errors));
+    }
+
+    /**
+     * 处理所有参数校验时抛出的异常
+     *
+     * @param ex
+     * @return
+     */
+    @ExceptionHandler(value = ValidationException.class)
+    @ResponseStatus(HttpStatus.BAD_REQUEST)
+    public ResultData handleBindException(ValidationException ex) {
+        // 获取所有异常
+        List<String> errors = new LinkedList<String>();
+        if (ex instanceof ConstraintViolationException) {
+            ConstraintViolationException exs = (ConstraintViolationException) ex;
+            Set<ConstraintViolation<?>> violations = exs.getConstraintViolations();
+            for (ConstraintViolation<?> item : violations) {
+                errors.add(item.getMessage());
+            }
+        }
+        return ResultData.fail(1, String.join(",", errors));
+    }
+
+    /**
+     * Controller参数绑定错误
+     *
+     * @param ex
+     * @return
+     */
+    @ExceptionHandler(MissingServletRequestParameterException.class)
+    public ResultData handleMissingServletRequestParameterException(MissingServletRequestParameterException ex) {
+        return ResultData.fail(1, ex.getMessage());
+    }
+}

+ 153 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/exception/ErrorCode.java

@@ -0,0 +1,153 @@
+package com.gonghang.h5clientapp.exception;
+
+/**
+ * 异常状态编码
+ * Created by shiwn on 2021/1/12 11:33
+ */
+public enum ErrorCode {
+    SUCCESS(0, "成功"),
+
+    SYSTEM_ERROR(500, "系统异常"),
+    OPERATION_FAILED(1, "操作失败"),
+    INSERT_ERROR(1, "数据插入失败"),
+    UPDATE_ERROR(1, "数据更新失败"),
+    DELETE_ERROR(1, "数据删除失败"),
+    PARAMETER_IS_NULL(401, "参数为空"),
+    PARAMETER_IS_ERROR(402, "参数错误"),
+    DATA_NULL(1, "数据不存在"),
+    UPLOAD_NULL(1, "上传文件不能为空"),
+    EXCEL_ERROR(1, "Excel文件读取失败"),
+    BAD_REQUEST(400, "请求参数不正确"),
+
+    //  任务相关
+    TASK_CREATE_ERROR(1, "任务创建失败"),
+    TASK_NAME_DUPLICATE(1, "任务名称重复"),
+    TASK_SENDED(1, "已下发任务不可修改或删除"),
+    TASK_DATA_NULL(1, "任务执行数据不存在"),
+    TASK_START_UPDATE_FAIL(1, "已执行任务不可修改"),
+
+    //  巡检点相关
+    CHECK_POINT_EXIST(1, "请先移除关联的巡检点"),
+    CHECK_POINT_NULL(1, "巡检点不存在"),
+
+    //  机器人相关
+    ROBOT_NULL(1, "机器人不存在"),
+    ROBOT_REBOOT_FAIL(1, "机器人重启失败!"),
+    ROBOT_UPDATE_TIME_FAIL(1, "机器人同步时间失败!"),
+    ROBOT_UPDATE_SETTING_FAIL(1, "更新机器人配置参数失败!"),
+    ROBOT_NO_SETTING(1, "未查询到机器人设置参数!"),
+    SEND_TASK_FAIL(1, "任务下发机器人失败"),
+    ROBOT_NO_EXECUTE_TASK(1, "机器人无正在执行任务"),
+    ROBOT_FOLLOWED(1, "请勿重复关注"),
+    ROBOT_RETURN_NULL(1, "机器人无返回数据!"),
+
+    //邮箱相关
+    EMAIL_NOT_SET(1, "邮箱服务未开启"),
+
+    EMAIL_SETTING_DATA_ERROR(1, "邮箱数据异常"),
+
+    //短信相关
+    SMS_SERVICE_ALREADY_OPEN(1, "短信服务已开启"),
+
+    SMS_ALIYUN_DATA_NULL(1, "阿里云短信设置参数不得为空"),
+
+    SMS_COM_DATA_NULL(1, "串口名称不得为空"),
+
+    //告警订阅相关
+    NOT_SET_MOBILE(1, "未设置手机号"),
+
+    NOT_SET_MAIL(1, "未设置邮箱"),
+
+    NOT_CHOOSE_CHECKPOINT(1, "未选择订阅的巡检点"),
+
+    SUBSCRIBE_NOT_EXIST(1, "订阅信息不存在"),
+
+    //    系统用户相关
+    ACCOUNT_NOT_EXIST(1, "用户不存在"),
+
+    ACCOUNT_NULL(1, "用户名不能为空"),
+
+    ACCOUNT_DUPLICATE(1, "用户名重复"),
+
+    MOBILE_DUPLICATE(1, "手机号重复"),
+
+    LOGIN_ERROR(1, "用户名或密码错误"),
+
+    LOGIN_FAIL(1, "登录失败"),
+
+    LOGIN_INVALIDATION(1, "登录失效"),
+
+    PASSWORD_ERROR(1, "密码错误"),
+
+    PASSWORD_NULL(1, "请输入密码"),
+
+    CONFIRM_PASSWORD_NULL(1, "请输入确认密码"),
+
+    CONFIRM_PASSWORD_ERROR(1, "两次密码输入不一致"),
+
+    //部门相关
+    DEPARTMENT_CODE_DUPLICATE(1, "部门编码重复"),
+
+    DEPARTMENT_EXIST_USER(1, "部门下存在用户"),
+
+    DEPARTMENT_EXIST_CHILDREN(1, "部门下存在下级"),
+
+    //权限相关
+    USER_PERMISSION_NOT_EXIST(1, "无用户权限"),
+
+    // 角色相关
+    ROLE_NOT_EXIST(1, "角色不存在"),
+
+    ROLE_NAME_DUPLICATE(1, "角色名称重复"),
+
+    ROLE_EXIST_USER(1, "角色下存在用户,不可直接删除!"),
+
+    //  redis相关
+    REDIS_UPDATE_FAIL(1, "redis缓存更新失败"),
+    // 文件上传有关
+    SIZE_TOO_LARGE(1, "上传文件超限"),
+
+    //导入导出相关
+    IMPORT_FAIL(1, "导入失败"),
+
+    IMPORT_DATA_NULL(1, "导入数据为空"),
+
+    IMPORT_DATA_ERROR(1, "导入数据缺少字段值!"),
+
+    LACK_FIELD(1, "导入excel缺少字段"),
+
+    EXPORT_DATA_NULL(1, "导出数据为空"),
+
+
+    //API通用状态码
+    KEYID_ERROR(202, "无效key"),
+
+    SNS_ERROR(202, "无效SNS"),
+
+    ACCOUNT_PWD_ERROR(204, "用户名或密码错误"),
+
+    GH_DATA_NULL(205, "返回结果为空"),
+
+    PARAMETER_ERROR(402, "参数错误"),
+
+    DATA_TOO_LARGE(1, "查询数据量太大,请缩小查询范围"),
+
+    SERVER_ID_ERROR(403, "无权限访问");
+
+
+    private int code;
+    private String msg;
+
+    ErrorCode(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+}

+ 17 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/EnvSettingService.java

@@ -0,0 +1,17 @@
+package com.gonghang.h5clientapp.service;
+
+import com.gonghang.h5clientapp.beans.dto.EnvDataDTO;
+import com.gonghang.h5clientapp.beans.dto.EnvSettingDTO;
+import com.gonghang.h5clientapp.beans.vo.AlarmResultVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by shiwn on 2022/8/3 14:44
+ */
+public interface EnvSettingService {
+    Map getData();
+
+    List<AlarmResultVO> envDataIsAlarm(EnvDataDTO envData, Map<String, EnvSettingDTO> envSettingMap);
+}

+ 169 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/EnvSettingServiceImpl.java

@@ -0,0 +1,169 @@
+package com.gonghang.h5clientapp.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gonghang.h5clientapp.beans.dto.EnvDataDTO;
+import com.gonghang.h5clientapp.beans.dto.EnvSettingDTO;
+import com.gonghang.h5clientapp.beans.vo.AlarmResultVO;
+import com.gonghang.h5clientapp.common.enumData.AlarmLevelEnum;
+import com.gonghang.h5clientapp.common.enumData.EnvTypeEnum;
+import com.gonghang.h5clientapp.dao.EnvSettingMapper;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * Created by shiwn on 2022/8/3 14:44
+ */
+@Service
+public class EnvSettingServiceImpl extends ServiceImpl<EnvSettingMapper, EnvSettingDTO> implements EnvSettingService {
+
+    @Override
+    public Map getData() {
+        List<EnvSettingDTO> list = this.list();
+        if (CollectionUtils.isEmpty(list)) {
+            return null;
+        }
+        Map<String, List<EnvSettingDTO>> collect = list.stream().sorted(Comparator.comparing(EnvSettingDTO::getId)).collect(Collectors.groupingBy(EnvSettingDTO::getEnvType));
+        Map<String, EnvSettingDTO> result = new HashMap<>();
+        if (!CollectionUtils.isEmpty(collect)) {
+            collect.entrySet().forEach(t -> {
+                        if (!CollectionUtils.isEmpty(t.getValue())) {
+                            result.put(t.getKey(), t.getValue().get(0));
+                        }
+                    }
+            );
+        }
+        return result;
+    }
+
+    @Override
+    public List<AlarmResultVO> envDataIsAlarm(EnvDataDTO envData, Map<String, EnvSettingDTO> envSettingMap) {
+        List<AlarmResultVO> alarmResult = new ArrayList<>(15);
+        //co
+        AlarmResultVO COalarmResult = checkEnvValue(envSettingMap.get(EnvTypeEnum.CO.toString()), String.valueOf(envData.getCo()));
+        COalarmResult.setDataId(envData.getId());
+        alarmResult.add(COalarmResult);
+        //co2
+        AlarmResultVO CO2alarmResult = checkEnvValue(envSettingMap.get(EnvTypeEnum.CO2.toString()), String.valueOf(envData.getCo2()));
+        CO2alarmResult.setDataId(envData.getId());
+        alarmResult.add(CO2alarmResult);
+
+        //SF6
+        AlarmResultVO SF6alarmResult = checkEnvValue(envSettingMap.get(EnvTypeEnum.SF6.toString()), String.valueOf(envData.getSf6()));
+        SF6alarmResult.setDataId(envData.getId());
+        alarmResult.add(SF6alarmResult);
+
+        //o3
+        AlarmResultVO O3alarmResult = checkEnvValue(envSettingMap.get(EnvTypeEnum.O3.toString()), String.valueOf(envData.getO3()));
+        O3alarmResult.setDataId(envData.getId());
+        alarmResult.add(O3alarmResult);
+
+        //temperature
+        AlarmResultVO temperatureResult = checkEnvValue(envSettingMap.get(EnvTypeEnum.TEMPERATURE.toString()), String.valueOf(envData.getTemperature()));
+        temperatureResult.setDataId(envData.getId());
+        alarmResult.add(temperatureResult);
+
+        //humidity
+        AlarmResultVO humidityResult = checkEnvValue(envSettingMap.get(EnvTypeEnum.HUMIDITY.toString()), String.valueOf(envData.getHumidity()));
+        humidityResult.setDataId(envData.getId());
+        alarmResult.add(humidityResult);
+        return alarmResult;
+    }
+
+
+    /**
+     * 私有:判断环境告警等级
+     *
+     * @param: envSetting 阈值设置
+     * @param: checkValue 检测数据
+     * @return:
+     * @author machao
+     * @date: 2021/7/16 11:25
+     */
+    private AlarmResultVO checkEnvValue(EnvSettingDTO envSetting, String checkValue) {
+        //初始化告警返回值
+        AlarmResultVO envAlarmResult = new AlarmResultVO();
+        envAlarmResult.setTargetId(envSetting.getId());
+        envAlarmResult.setAlarmFor(envSetting.getEnvType());
+        envAlarmResult.setDiscernResult(StringUtils.isEmpty(checkValue) ? "" : Float.valueOf(checkValue).toString());
+        envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.NORMAL.getCode()));
+        if (envSetting == null || StringUtils.isEmpty(checkValue)) {
+            return envAlarmResult;
+        }
+        BigDecimal value = new BigDecimal(checkValue);
+
+        //若值在安全范围类返回正常
+        if (!StringUtils.isEmpty(envSetting.getSafeMin()) && !StringUtils.isEmpty(envSetting.getSafeMax())) {
+            if (new BigDecimal(envSetting.getSafeMin()).compareTo(value) <= 0
+                    && new BigDecimal(envSetting.getSafeMax()).compareTo(value) > 0) {
+                envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.NORMAL.getCode()));
+                return envAlarmResult;
+            }
+        } else {
+            if (new BigDecimal(envSetting.getSafeMax()).compareTo(value) >= 0) {
+                envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.NORMAL.getCode()));
+                return envAlarmResult;
+            }
+        }
+        //危急告警
+        if (!StringUtils.isEmpty(envSetting.getSeriousWarningMin()) &&
+                new BigDecimal(envSetting.getSeriousWarningMin()).compareTo(value) <= 0) {
+            envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.TYPE_4.getCode()));
+            return envAlarmResult;
+        }
+
+        if (!StringUtils.isEmpty(envSetting.getSeriousWarningMax()) &&
+                new BigDecimal(envSetting.getSeriousWarningMax()).compareTo(value) >= 0) {
+            envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.TYPE_4.getCode()));
+            return envAlarmResult;
+        }
+
+        //一般告警 双段式 先判断去区间值的情况 若有区间值则比较区间值 否则比较单边值
+        if (!StringUtils.isEmpty(envSetting.getEarlyWarningMin1()) && !StringUtils.isEmpty(envSetting.getEarlyWarningMax1())) {
+            if (new BigDecimal(envSetting.getEarlyWarningMin1()).compareTo(value) <= 0
+                    && new BigDecimal(envSetting.getEarlyWarningMax1()).compareTo(value) > 0) {
+                envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.TYPE_2.getCode()));
+                return envAlarmResult;
+            }
+        } else {
+
+            if (!StringUtils.isEmpty(envSetting.getEarlyWarningMin1())
+                    && new BigDecimal(envSetting.getEarlyWarningMin1()).compareTo(value) <= 0) {
+                envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.TYPE_2.getCode()));
+                return envAlarmResult;
+            }
+
+            if (!StringUtils.isEmpty(envSetting.getEarlyWarningMax1())
+                    && new BigDecimal(envSetting.getEarlyWarningMax1()).compareTo(value) >= 0) {
+                envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.TYPE_2.getCode()));
+                return envAlarmResult;
+            }
+        }
+        if (!StringUtils.isEmpty(envSetting.getEarlyWarningMin2()) && !StringUtils.isEmpty(envSetting.getEarlyWarningMax2())) {
+            if (new BigDecimal(envSetting.getEarlyWarningMin2()).compareTo(value) <= 0
+                    && new BigDecimal(envSetting.getEarlyWarningMax2()).compareTo(value) > 0) {
+                envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.TYPE_2.getCode()));
+                return envAlarmResult;
+            }
+        } else {
+            if (!StringUtils.isEmpty(envSetting.getEarlyWarningMin2())
+                    && new BigDecimal(envSetting.getEarlyWarningMin1()).compareTo(value) <= 0) {
+                envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.TYPE_2.getCode()));
+                return envAlarmResult;
+            }
+
+            if (!StringUtils.isEmpty(envSetting.getEarlyWarningMax2())
+                    && new BigDecimal(envSetting.getEarlyWarningMax1()).compareTo(value) >= 0) {
+                envAlarmResult.setAlarmLevel(String.valueOf(AlarmLevelEnum.TYPE_2.getCode()));
+                return envAlarmResult;
+            }
+
+        }
+
+        return envAlarmResult;
+    }
+}

+ 20 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/GhH5Service.java

@@ -0,0 +1,20 @@
+package com.gonghang.h5clientapp.service;
+
+import com.github.pagehelper.PageInfo;
+import com.gonghang.h5clientapp.beans.vo.GhRobotVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by shiwn on 2022/7/5 9:01
+ */
+public interface GhH5Service {
+    List<GhRobotVO> getRobotList();
+
+    Map getRobotInfo(Integer robotId);
+
+    PageInfo getTaskList(Integer pageNum, Integer pageSize, Integer robotId);
+
+    PageInfo getReportList(Integer pageNum, Integer pageSize, Integer robotId);
+}

+ 417 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/GhH5ServiceImpl.java

@@ -0,0 +1,417 @@
+package com.gonghang.h5clientapp.service;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.gonghang.h5clientapp.beans.RobotData;
+import com.gonghang.h5clientapp.beans.dto.*;
+import com.gonghang.h5clientapp.beans.vo.*;
+import com.gonghang.h5clientapp.common.RedisKey;
+import com.gonghang.h5clientapp.common.enumData.EnvTypeEnum;
+import com.gonghang.h5clientapp.common.enumData.TaskStatusEnum;
+import com.gonghang.h5clientapp.dao.*;
+import com.gonghang.h5clientapp.util.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by shiwn on 2022/7/5 9:01
+ */
+@Service
+public class GhH5ServiceImpl implements GhH5Service {
+    @Autowired
+    private RobotMapper robotMapper;
+    @Autowired
+    private EnvDataMapper envDataMapper;
+    @Autowired
+    private EnvSettingService envSettingService;
+    @Autowired
+    private CheckTaskMapper taskMapper;
+    @Autowired
+    private CheckPointMapper pointMapper;
+    @Autowired
+    private TaskDataMapper taskDataMapper;
+    @Autowired
+    private RobotSettingMapper robotSettingMapper;
+    @Autowired
+    private TaskReportMapper reportMapper;
+    @Autowired
+    private RobotWarningService robotWarningService;
+    @Autowired
+    private MapService mapService;
+    @Autowired
+    RedisUtils redisUtils;
+
+    /**
+     * 全局变量,保存全部机器人
+     */
+    private List<GhRobotVO> listRobot = new ArrayList<>();
+
+    /**
+     * @Description: 获取机器人列表
+     * @Author: shiwn
+     * @Param: []
+     * @Return:
+     */
+    @Override
+    public List<GhRobotVO> getRobotList() {
+        //  查询
+        List<GhRobotVO> list = new ArrayList<>();
+        List<RobotDTO> listDto = robotMapper.queryAllRobots();
+        //  封装
+        listDto.forEach(i -> {
+            GhRobotVO vo = new GhRobotVO();
+            vo.setRobotId(i.getId());
+            vo.setRobotIp(i.getIp());
+            vo.setRobotName(i.getRobotName());
+            list.add(vo);
+        });
+        // 返回
+        listRobot = list;
+        return list;
+    }
+
+    /**
+     * @Description: 查询机器人信息
+     * @Date: 2022/7/5 11:39
+     * @Author: shiwn
+     * @Param: [robotId]
+     * @Return:
+     */
+    @Override
+    public Map getRobotInfo(Integer robotId) {
+        Map map = new HashMap();
+        //  环境
+        GhEnvDataVO envDataVO = getEnvData(robotId);
+        map.put("envData", envDataVO);
+        //  任务
+        GhCurrentTaskVO currentTaskVO = getCurrentTask(robotId);
+        map.put("taskData", currentTaskVO);
+        //  自检
+        Boolean robotCheck = getRobotCheck(getRobotIpById(robotId));
+        map.put("checkData", robotCheck);
+        //  地图
+        RobotMapDTO mapDTO = getRobotMap(robotId);
+        map.put("mapData", mapDTO);
+        //  实时状态
+        GhRobotStatusVO statusVO = getRobotStatus(getRobotIpById(robotId));
+        map.put("robotData", statusVO);
+
+        //  返回
+        return map;
+    }
+
+    /**
+     * @Description: 获取机器人的环境数据
+     * @Date: 2022/7/5 9:36
+     * @Author: shiwn
+     * @Param: [robotId]
+     * @Return:
+     */
+    private GhEnvDataVO getEnvData(Integer robotId) {
+        GhEnvDataVO vo = new GhEnvDataVO();
+        //  查询最新环境数据
+        EnvDataDTO dto = envDataMapper.selectByRobotId(robotId);
+        if (dto != null) {
+            //  获取环境阈值
+            Map<String, EnvSettingDTO> envSettingMap = envSettingService.getData();
+            //  判断是否设置环境阈值
+            boolean checkHumidity = false;
+            boolean checkTemperature = false;
+            boolean checkCo = false;
+            boolean checkCo2 = false;
+            boolean checkO3 = false;
+            boolean checkSf6 = false;
+            //  判断环境阈值是否告警
+            if (!CollectionUtils.isEmpty(envSettingMap)) {
+                List<AlarmResultVO> alarmList = envSettingService.envDataIsAlarm(dto, envSettingMap);
+
+                AlarmResultVO humiditySet = alarmList.stream().filter(i -> i.getAlarmFor().equals(EnvTypeEnum.HUMIDITY.getIndex())).findFirst().orElse(null);
+                checkHumidity = humiditySet == null ? false : (Integer.parseInt(humiditySet.getAlarmLevel()) > 0 ? true : false);
+
+                AlarmResultVO temperatureSet = alarmList.stream().filter(i -> i.getAlarmFor().equals(EnvTypeEnum.TEMPERATURE.getIndex())).findFirst().orElse(null);
+                checkTemperature = temperatureSet == null ? false : (Integer.parseInt(temperatureSet.getAlarmLevel()) > 0 ? true : false);
+
+                AlarmResultVO coSet = alarmList.stream().filter(i -> i.getAlarmFor().equals(EnvTypeEnum.CO.getIndex())).findFirst().orElse(null);
+                checkCo = coSet == null ? false : (Integer.parseInt(coSet.getAlarmLevel()) > 0 ? true : false);
+
+                AlarmResultVO co2Set = alarmList.stream().filter(i -> i.getAlarmFor().equals(EnvTypeEnum.CO2.getIndex())).findFirst().orElse(null);
+                checkCo2 = co2Set == null ? false : (Integer.parseInt(co2Set.getAlarmLevel()) > 0 ? true : false);
+
+                AlarmResultVO o3Set = alarmList.stream().filter(i -> i.getAlarmFor().equals(EnvTypeEnum.O3.getIndex())).findFirst().orElse(null);
+                checkO3 = o3Set == null ? false : (Integer.parseInt(o3Set.getAlarmLevel()) > 0 ? true : false);
+
+                AlarmResultVO sf6Set = alarmList.stream().filter(i -> i.getAlarmFor().equals(EnvTypeEnum.SF6.getIndex())).findFirst().orElse(null);
+                checkSf6 = sf6Set == null ? false : (Integer.parseInt(sf6Set.getAlarmLevel()) > 0 ? true : false);
+            }
+
+            //  封装
+            vo.setHumidity(dto.getHumidity());
+            vo.setCheckHumidity(checkHumidity);
+
+            vo.setTemperature(dto.getTemperature());
+            vo.setCheckTemperature(checkTemperature);
+
+            vo.setCo(dto.getCo());
+            vo.setCheckCo(checkCo);
+
+            vo.setCo2(dto.getCo2());
+            vo.setCheckCo2(checkCo2);
+
+            vo.setSf6(dto.getSf6());
+            vo.setCheckSf6(checkSf6);
+
+            vo.setO3(dto.getO3());
+            vo.setCheckO3(checkO3);
+
+            if (dto.getMq() != null) {
+                vo.setMq(dto.getMq() > 0 ? "有" : "无");
+            }
+            if (dto.getFire() != null) {
+                vo.setFire(dto.getFire() > 0 ? "有" : "无");
+            }
+            if (dto.getMq() != null) {
+                vo.setAirQuality(dto.getMq() > 0 ? "有" : "无");
+            }
+        }
+        //  返回
+        return vo;
+    }
+
+    /**
+     * @Description: 获取机器人实时状态数据
+     * @Author: shiwn
+     * @Param: [robotIp]
+     * @Return:
+     */
+    private GhRobotStatusVO getRobotStatus(String robotIp) {
+        GhRobotStatusVO vo = new GhRobotStatusVO();
+        //  查询机器人是否离线
+        RobotDTO robotDTO = robotMapper.selectRobotByIP(robotIp);
+        if (robotDTO.getStatus() != 1) {
+            return vo;
+        }
+        //  获取机器人实时状态信息
+        RobotData robotData = (RobotData) redisUtils.get(RedisKey.ROBOT_DATA + robotIp);
+
+        if (robotData != null) {
+            //  封装
+            vo.setSystemCom(robotData.getSystemCom());
+            vo.setCap(robotData.getCap());
+            vo.setTemp(robotData.getTemp());
+            vo.setWorkTemp(robotData.getWorkTemp());
+            vo.setChargingStatus(robotData.isChargingStatus());
+            vo.setOpenRadar(robotData.isOpenRadar());
+            vo.setMapX(robotData.getPosX());
+            vo.setMapY(robotData.getPosY());
+
+            //  判断告警
+            vo = checkRobotWaring(vo, robotIp);
+        }
+        //  返回
+        return vo;
+    }
+
+    /**
+     * @Description: 获取实时任务数据
+     * @Author: shiwn
+     * @Return:
+     */
+    private GhCurrentTaskVO getCurrentTask(Integer robotId) {
+        GhCurrentTaskVO vo = new GhCurrentTaskVO();
+        if (robotId == null) {
+            return vo;
+        }
+        //  获取正在执行的任务数据
+        CheckTaskDTO taskDTO = taskMapper.selectByTaskStatus(robotId, TaskStatusEnum.WORKING.getCode());
+        //  判断是否有正在执行的任务
+        if (taskDTO == null) {
+            //  没有则返回最新一条任务
+            taskDTO = taskMapper.selectNewByRobotId(robotId);
+            //  还没有则返回null
+            if (taskDTO == null) {
+                return vo;
+            }
+        }
+        //  查询任务执行数据
+        TaskDataDTO taskDataDTO = taskDataMapper.selectCurrentTask(taskDTO.getId());
+        //  当前获取巡检点数据
+        CheckPointDTO pointDTO = pointMapper.selectByPointId(taskDataDTO.getCurrentPoint());
+
+        //  封装
+        //  任务名称
+        vo.setTaskName(taskDTO.getTaskName());
+        //  任务状态
+        vo.setTaskStatus(taskDTO.getTaskStatus());
+        //  当前巡检点
+        if (pointDTO != null) {
+            vo.setPointName(pointDTO.getPointName());
+        }
+        //  预计时长
+        vo.setUseTime(taskDataDTO.getUseTime());
+        //  进度
+        vo.setTaskProgress(taskDataDTO.getTaskProgress());
+        //  全部点位数
+        int total = taskDataDTO.getTotalPointNum();
+        vo.setTotalPointNum(total);
+        //  已巡检数
+        int checked = taskDataDTO.getCheckedPointNum();
+        vo.setCheckedPointNum(checked);
+        //  未巡检数
+        int notChecked = total - checked;
+        vo.setNotCheckedPointNum(notChecked);
+        //  异常数
+        int error = taskDataDTO.getWarningPointNum();
+        vo.setErrorPointNum(error);
+        //  正常数
+        int normal = checked - error;
+        normal = normal < 0 ? 0 : normal;
+        vo.setNormalPointNum(normal);
+
+        //  返回
+        return vo;
+    }
+
+    /**
+     * @Description: 获取机器人自检告警状态
+     * @Author: shiwn
+     * @Param: [robotIp]
+     * @Return:
+     */
+    private Boolean getRobotCheck(String robotIp) {
+        return robotWarningService.getStatus(robotIp);
+    }
+
+    /**
+     * @Description: 获取机器人地图数据
+     * @Date: 2022/7/5 10:20
+     * @Author: shiwn
+     * @Param: [robotId]
+     * @Return:
+     */
+    private RobotMapDTO getRobotMap(Integer robotId) {
+        RobotMapDTO dto = mapService.getMapByRobotId(robotId);
+        return dto;
+    }
+
+    /**
+     * @Description: 查询任务列表
+     * @Date: 2022/7/5 10:46
+     * @Author: shiwn
+     * @Param: [pageNum, pageSize, robotId]
+     * @Return:
+     */
+    @Override
+    public PageInfo getTaskList(Integer pageNum, Integer pageSize, Integer robotId) {
+        //  初始化
+        pageNum = pageNum == null ? 1 : pageNum;
+        pageSize = pageSize == null ? 10 : pageSize;
+        PageHelper.startPage(pageNum, pageSize);
+        //  查询
+        robotId = null;
+        List list = taskMapper.selectTaskList(robotId);
+        //  返回
+        PageInfo pageOrg = new PageInfo<>(list);
+        return pageOrg;
+    }
+
+    /**
+     * @Description: 查询报告列表
+     * @Date: 2022/7/5 10:52
+     * @Author: shiwn
+     * @Param: [pageNum, pageSize, robotId]
+     * @Return:
+     */
+    @Override
+    public PageInfo getReportList(Integer pageNum, Integer pageSize, Integer robotId) {
+        //  初始化
+        pageNum = pageNum == null ? 1 : pageNum;
+        pageSize = pageSize == null ? 10 : pageSize;
+        PageHelper.startPage(pageNum, pageSize);
+        //  查询
+        robotId = null;
+        List list = reportMapper.selectReportList(robotId);
+        //  返回
+        PageInfo pageOrg = new PageInfo<>(list);
+        return pageOrg;
+    }
+
+    /**
+     * @Description: id 转 ip
+     * @Date: 2022/7/5 11:44
+     * @Author: shiwn
+     * @Param: [robotId]
+     * @Return:
+     */
+    private String getRobotIpById(Integer robotId) {
+        String robotIp = "";
+        if (listRobot.size() == 0) {
+            getRobotList();
+        }
+        if (listRobot.size() > 0) {
+            GhRobotVO dto = listRobot.stream().filter(i -> i.getRobotId().equals(robotId)).findFirst().get();
+            robotIp = dto.getRobotIp();
+        }
+        return robotIp;
+    }
+
+    /**
+     * @Description: ip 转 id
+     * @Date: 2022/7/5 11:44
+     * @Author: shiwn
+     * @Param: [robotId]
+     * @Return:
+     */
+    private Integer getRobotIdByIp(String robotIp) {
+        Integer robotId = 0;
+        if (listRobot.size() == 0) {
+            getRobotList();
+        }
+        if (listRobot.size() > 0) {
+            GhRobotVO dto = listRobot.stream().filter(i -> i.getRobotIp().equals(robotIp)).findFirst().get();
+            robotId = dto.getRobotId();
+        }
+        return robotId;
+    }
+
+    /**
+     * @Description: 机器人机身温度、电池温度、电量告警
+     * @Author: shiwn
+     */
+    private GhRobotStatusVO checkRobotWaring(GhRobotStatusVO vo, String robotIp) {
+        //  查询机器人id
+        Integer robotId = getRobotIdByIp(robotIp);
+        //  查询配置
+        RobotSettingDTO dto = robotSettingMapper.selectByRobotId(robotId);
+        //  判断告警
+        if (dto != null) {
+            //  机身温度
+            Integer robotTemp = dto.getRobotTemp();
+            if (robotTemp != null) {
+                if (vo.getWorkTemp().compareTo((float) robotTemp) > 0) {
+                    vo.setCheckWorkTemp(true);
+                }
+            }
+            //  电池温度
+            Integer batteryTemp = dto.getBatteryTemp();
+            if (batteryTemp != null) {
+                if (vo.getTemp().compareTo((float) batteryTemp) > 0) {
+                    vo.setCheckTemp(true);
+                }
+            }
+            //  电量
+            Integer batteryLow = dto.getBatteryLow();
+            if (batteryLow != null) {
+                if (vo.getCap().compareTo((float) batteryLow) < 0) {
+                    vo.setCheckCap(true);
+                }
+            }
+        }
+        return vo;
+    }
+}

+ 10 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/MapService.java

@@ -0,0 +1,10 @@
+package com.gonghang.h5clientapp.service;
+
+import com.gonghang.h5clientapp.beans.dto.RobotMapDTO;
+
+/**
+ * Created by shiwn on 2022/8/3 15:48
+ */
+public interface MapService {
+    RobotMapDTO getMapByRobotId(Integer robotId);
+}

+ 20 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/MapServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gonghang.h5clientapp.service;
+
+import com.gonghang.h5clientapp.beans.dto.RobotMapDTO;
+import com.gonghang.h5clientapp.dao.RobotMapMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by shiwn on 2022/8/3 15:48
+ */
+@Service
+public class MapServiceImpl implements MapService {
+    @Autowired
+    private RobotMapMapper robotMapMapper;
+
+    @Override
+    public RobotMapDTO getMapByRobotId(Integer robotId) {
+        return robotMapMapper.selectMapByRobotId(robotId);
+    }
+}

+ 8 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/RobotWarningService.java

@@ -0,0 +1,8 @@
+package com.gonghang.h5clientapp.service;
+
+/**
+ * Created by shiwn on 2022/8/3 15:43
+ */
+public interface RobotWarningService {
+    Boolean getStatus(String robotIp);
+}

+ 38 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/service/RobotWarningServiceImpl.java

@@ -0,0 +1,38 @@
+package com.gonghang.h5clientapp.service;
+
+import com.gonghang.h5clientapp.beans.dto.RobotWarningDTO;
+import com.gonghang.h5clientapp.dao.RobotWarningMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by shiwn on 2022/8/3 15:44
+ */
+@Service
+public class RobotWarningServiceImpl implements RobotWarningService {
+    @Autowired
+    private RobotWarningMapper robotWarningMapper;
+
+    /**
+     * @Description: 判断机器人是否自检告警
+     * @Date: 2022/7/5 10:08
+     * @Author: shiwn
+     * @Param: [robotIp]
+     * @Return: true-告警,false-不告警
+     */
+    @Override
+    public Boolean getStatus(String robotIp) {
+        boolean status = false;
+        //  查询最新的告警记录
+        RobotWarningDTO dto = robotWarningMapper.selectNewOne(robotIp);
+        //  判断是否告警
+        if (dto == null) {
+            return status;
+        }
+        if (!dto.getFaultCode().equals("000")) {
+            status = true;
+        }
+        //  返回
+        return status;
+    }
+}

+ 553 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/util/RedisUtils.java

@@ -0,0 +1,553 @@
+package com.gonghang.h5clientapp.util;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * redis 工具类
+ * Created by shiwn on 2021/5/11 10:48
+ */
+@Component
+public class RedisUtils {
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+    // =============================common===========================
+
+    /**
+     * @Description: 指定缓存失效时间
+     * @Param: [key:键,  expireTime:失效时间(秒)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:29
+     */
+    public boolean expire(String key, long expireTime) {
+        try {
+            if (expireTime > 0) {
+                redisTemplate.expire(key, expireTime, TimeUnit.SECONDS);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 根据key 获取过期时间
+     * @Param: [key:键]
+     * @Author: shiwn
+     * @Return: 时间(秒),返回0代表为永久有效
+     * @Date: 2021/5/11 10:54
+     */
+    public long getExpire(String key) {
+        return redisTemplate.getExpire(key, TimeUnit.SECONDS);
+    }
+
+    /**
+     * @Description: 判断key是否存在
+     * @Param: [key:键]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:31
+     */
+    public boolean hasKey(String key) {
+        try {
+            return redisTemplate.hasKey(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 删除缓存
+     * @Param: [key:键,可以传一个值或多个]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:32
+     */
+    @SuppressWarnings("unchecked")
+    public void del(String... key) {
+        if (key != null && key.length > 0) {
+            if (key.length == 1) {
+                redisTemplate.delete(key[0]);
+            } else {
+                redisTemplate.delete(CollectionUtils.arrayToList(key));
+            }
+        }
+    }
+
+    // ============================String=============================
+
+    /**
+     * @Description: 获取缓存值
+     * @Param: [key]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:38
+     */
+    public Object get(String key) {
+        return key == null ? null : redisTemplate.opsForValue().get(key);
+    }
+
+    /**
+     * @Description: 写入缓存
+     * @Param: [key, value]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:38
+     */
+    public boolean set(String key, Object value) {
+        try {
+            redisTemplate.opsForValue().set(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 写入缓存,并设置时效时间
+     * @Param: [key:键, value:值, expireTime:失效时间(秒)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 10:52
+     */
+    public boolean set(final String key, Object value, Long expireTime) {
+        try {
+            if (expireTime > 0) {
+                redisTemplate.opsForValue().set(key, value, expireTime, TimeUnit.SECONDS);
+                return true;
+            }
+            return false;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 缓存值递增
+     * @Param: [key:键, delta:递增值,要增加几(大于0)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:40
+     */
+    public long incr(String key, long delta) {
+        if (delta < 0) {
+            throw new RuntimeException("递增因子必须大于0");
+        }
+        return redisTemplate.opsForValue().increment(key, delta);
+    }
+
+    /**
+     * @Description: 缓存值递减
+     * @Param: [key:键, delta:递增值,要减少几(小于0)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:41
+     */
+    public long decr(String key, long delta) {
+        if (delta < 0) {
+            throw new RuntimeException("递减因子必须大于0");
+        }
+        return redisTemplate.opsForValue().increment(key, -delta);
+    }
+
+    // ================================Map=================================
+
+    /**
+     * @Description: HashGet
+     * @Param: [key:键(不能为null), item:项(不能为null)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:43
+     */
+    public Object hGet(String key, String item) {
+        return redisTemplate.opsForHash().get(key, item);
+    }
+
+    /**
+     * @Description: 获取hashKey对应的所有键值
+     * @Param: [key:键]
+     * @Return 对应的多个键值
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:44
+     */
+    public Map<Object, Object> hmGet(String key) {
+        return redisTemplate.opsForHash().entries(key);
+    }
+
+    /**
+     * @Description: HashSet
+     * @Param: [key, map]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:47
+     */
+    public boolean hmSet(String key, Map<String, Object> map) {
+        try {
+            redisTemplate.opsForHash().putAll(key, map);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: HashSet,并设置失效时间
+     * @Param: [key, map, time:失效时间(秒)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:48
+     */
+    public boolean hmSet(String key, Map<String, Object> map, long time) {
+        try {
+            redisTemplate.opsForHash().putAll(key, map);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 向一张hash表中放入数据, 如果不存在将创建
+     * @Param: [key:键, item:项, value:值]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:49
+     */
+    public boolean hSet(String key, String item, Object value) {
+        try {
+            redisTemplate.opsForHash().put(key, item, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 向一张hash表中放入数据, 如果不存在将创建,并设置失效时间。
+     * 如果已存在的hash表有失效时间,这里将会替换原有的时间
+     * @Param: [key, item, value, time:失效时间(秒)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:50
+     */
+    public boolean hSet(String key, String item, Object value, long time) {
+        try {
+            redisTemplate.opsForHash().put(key, item, value);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 删除hash表中的值
+     * @Param: [key:键, item:项(一个或多个,不能为null)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:51
+     */
+    public void hDel(String key, Object... item) {
+        redisTemplate.opsForHash().delete(key, item);
+    }
+
+    /**
+     * @Description: 判断hash表中是否有该项的值
+     * @Param: [key:键, item:项]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:52
+     */
+    public boolean hHasKey(String key, String item) {
+        return redisTemplate.opsForHash().hasKey(key, item);
+    }
+
+    /**
+     * @Description: hash递增
+     * 如果不存在,就会创建一个 并把新增后的值返回
+     * @Param: [key:键, item:项, by:要增加几(大于0)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:52
+     */
+    public double hIncr(String key, String item, double by) {
+        return redisTemplate.opsForHash().increment(key, item, by);
+    }
+
+    /**
+     * @Description: hash递减
+     * 如果不存在,就会创建一个 并把新增后的值返回
+     * @Param: [key:键, item:项, by:要减少记(小于0)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:53
+     */
+    public double hDecr(String key, String item, double by) {
+        return redisTemplate.opsForHash().increment(key, item, -by);
+    }
+
+
+    // ============================set=============================
+
+    /**
+     * @Description: 根据key获取Set中的所有值
+     * @Param: [key]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:54
+     */
+    public Set<Object> sGet(String key) {
+        try {
+            return redisTemplate.opsForSet().members(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * @Description: 根据value从一个set中查询, 是否存在
+     * @Param: [key, value]
+     * @Author: shiwn
+     * @Date: 2021/5/11 11:55
+     */
+    public boolean sHasKey(String key, Object value) {
+        try {
+            return redisTemplate.opsForSet().isMember(key, value);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 将数据放入set缓存
+     * @Param: [key, values:值(一个或多个)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:21
+     */
+    public long sSet(String key, Object... values) {
+        try {
+            return redisTemplate.opsForSet().add(key, values);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * @Description: 将set数据放入缓存,并设置失效时间
+     * @Param: [key, time:失效时间(秒), values:值(一个或多个)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:21
+     */
+    public long sSet(String key, long time, Object... values) {
+        try {
+            Long count = redisTemplate.opsForSet().add(key, values);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return count;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * @Description: 获取set缓存的长度
+     * @Param: [key]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:22
+     */
+    public long sGetSize(String key) {
+        try {
+            return redisTemplate.opsForSet().size(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * @Description: 移除值为value的
+     * @Param: [key, values:值(一个或多个)]
+     * @Return 移除的个数
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:23
+     */
+    public long sRemove(String key, Object... values) {
+        try {
+            Long count = redisTemplate.opsForSet().remove(key, values);
+            return count;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+
+    // ===============================list=================================
+
+    /**
+     * @Description: 将list放入缓存
+     * @Param: [key, value]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:26
+     */
+    public boolean lSet(String key, Object value) {
+        try {
+            redisTemplate.opsForList().rightPush(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 将list放入缓存
+     * @Param: [key, value]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:27
+     */
+    public boolean lSet(String key, List<Object> value) {
+        try {
+            redisTemplate.opsForList().rightPushAll(key, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 将list放入缓存,并设置失效时间
+     * @Param: [key, value, time:失效时间(秒)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:27
+     */
+    public boolean lSet(String key, Object value, long time) {
+        try {
+            redisTemplate.opsForList().rightPush(key, value);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 将list放入缓存,并设置失效时间
+     * @Param: [key, value, time:失效时间(秒]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:28
+     */
+    public boolean lSet(String key, List<Object> value, long time) {
+        try {
+            redisTemplate.opsForList().rightPushAll(key, value);
+            if (time > 0) {
+                expire(key, time);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 获取list缓存的内容
+     * start:0,end:-1代表所有值
+     * @Param: [key, start:开始索引, end:结束索引]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:24
+     */
+    public List<Object> lGet(String key, long start, long end) {
+        try {
+            return redisTemplate.opsForList().range(key, start, end);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public List<Object> lGet(String key) {
+        try {
+            return redisTemplate.opsForList().range(key, 0, -1);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * @Description: 获取list缓存的长度
+     * @Param: [key]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:25
+     */
+    public long lGetSize(String key) {
+        try {
+            return redisTemplate.opsForList().size(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+
+    /**
+     * @Description: 通过索引 获取list中的值
+     * @Param: [key, index:索引(index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推)]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:25
+     */
+    public Object lGetIndex(String key, long index) {
+        try {
+            return redisTemplate.opsForList().index(key, index);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * @Description: 根据索引修改list中的某条数据
+     * @Param: [key, index:索引, value]
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:29
+     */
+    public boolean lUpdateIndex(String key, long index, Object value) {
+        try {
+            redisTemplate.opsForList().set(key, index, value);
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    /**
+     * @Description: 移除N个值为value的缓存
+     * @Param: [key, count:移除数量, value]
+     * @Return 移除的个数
+     * @Author: shiwn
+     * @Date: 2021/5/11 14:29
+     */
+    public long lRemove(String key, long count, Object value) {
+        try {
+            Long remove = redisTemplate.opsForList().remove(key, count, value);
+            return remove;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
+}

+ 38 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/web/GhH5Api.java

@@ -0,0 +1,38 @@
+package com.gonghang.h5clientapp.web;
+
+import com.gonghang.h5clientapp.common.ResultData;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * Created by shiwn on 2022/7/5 8:59
+ */
+@Api(tags = {"上海工商银行,掌上运维"})
+public interface GhH5Api {
+    @ApiOperation(value = "查询机器人列表")
+    ResultData getRobotList();
+
+    @ApiOperation(value = "查询机器人数据")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "robotId", value = "机器人id", dataType = "int")
+    })
+    ResultData getRobotInfo(Integer robotId);
+
+    @ApiOperation(value = "查询任务列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "第几页(默认1)", dataType = "int"),
+            @ApiImplicitParam(name = "pageSize", value = "每页大小(默认20)", dataType = "int"),
+            @ApiImplicitParam(name = "robotId", value = "机器人id", dataType = "int")
+    })
+    ResultData getTaskList(Integer pageNum, Integer pageSize, Integer robotId);
+
+    @ApiOperation(value = "查询报告列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "第几页(默认1)", dataType = "int"),
+            @ApiImplicitParam(name = "pageSize", value = "每页大小(默认20)", dataType = "int"),
+            @ApiImplicitParam(name = "robotId", value = "机器人id", dataType = "int")
+    })
+    ResultData getReportList(Integer pageNum, Integer pageSize, Integer robotId);
+}

+ 42 - 0
code/h5client-app/src/main/java/com/gonghang/h5clientapp/web/GhH5Controller.java

@@ -0,0 +1,42 @@
+package com.gonghang.h5clientapp.web;
+
+import com.gonghang.h5clientapp.common.ResultData;
+import com.gonghang.h5clientapp.service.GhH5Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by shiwn on 2022/7/5 8:59
+ */
+@RestController
+@RequestMapping("/mobile/robotH5")
+public class GhH5Controller implements GhH5Api{
+    @Autowired
+    private GhH5Service ghH5Service;
+
+    @Override
+    @GetMapping("/getRobotList")
+    public ResultData getRobotList(){
+        return ResultData.success(ghH5Service.getRobotList());
+    }
+
+    @Override
+    @GetMapping("/getRobotInfo")
+    public ResultData getRobotInfo(Integer robotId){
+        return ResultData.success(ghH5Service.getRobotInfo(robotId));
+    }
+
+    @Override
+    @GetMapping("/getTaskList")
+    public ResultData getTaskList(Integer pageNum, Integer pageSize, Integer robotId) {
+        return ResultData.success(ghH5Service.getTaskList(pageNum, pageSize, robotId));
+    }
+
+    @Override
+    @GetMapping("/getReportList")
+    public ResultData getReportList(Integer pageNum, Integer pageSize, Integer robotId) {
+        return ResultData.success(ghH5Service.getReportList(pageNum, pageSize, robotId));
+    }
+}

+ 53 - 0
code/h5client-app/src/main/resources/application-dev.properties

@@ -0,0 +1,53 @@
+### Mysql数据库配置信息(用户数据持久化存储)
+spring.datasource.drive-class-name=com.mysql.cj.jdbc.Driver
+spring.datasource.url=jdbc:mysql://192.168.1.144:3306/robot_cloud_db.v4_new?serverTimezone=GMT%2B8&characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes&useSSL=false
+#数据库账号
+spring.datasource.username=root
+#数据库访问密码
+spring.datasource.password=pass123
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
+
+#############连接池的配置信息
+# 初始化大小,最小,最大
+spring.datasource.initialSize=5
+spring.datasource.minIdle=5
+spring.datasource.maxActive=20
+# 配置获取连接等待超时的时间
+spring.datasource.maxWait=60000
+# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+spring.datasource.timeBetweenEvictionRunsMillis=60000
+# 配置一个连接在池中最小生存的时间,单位是毫秒
+spring.datasource.minEvictableIdleTimeMillis=300000
+# 配置自动检测一些连接是否有效
+spring.datasource.validationQuery=SELECT 1 FROM DUAL
+spring.datasource.testWhileIdle=true
+spring.datasource.testOnBorrow=false
+spring.datasource.testOnReturn=false
+# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙(不推荐加上)
+spring.datasource.filters=stat
+# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+#spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+# 合并多个DruidDataSource的监控数据
+spring.datasource.useGlobalDataSourceStat=true
+
+############# 配置redis缓存(高频交互数据临时存储) #####
+#Redis
+# 连接的数据仓库(默认为0)
+spring.redis.database=0
+# redis服务ip
+spring.redis.host=192.168.1.144
+# redis端口号
+spring.redis.port=6379
+# redis密码
+spring.redis.password=sunwin@2021
+# 连接池最大连接数(使用负值表示没有限制)
+#spring.redis.pool.max-active=8
+# 连接池最大阻塞等待时间(使用负值表示没有限制)
+#spring.redis.pool.max-wait=-1
+# 连接池中的最大空闲连接
+#spring.redis.pool.max-idle=8
+# 连接池中的最小空闲连接
+#spring.redis.pool.min-idle=0
+# 连接超时时间(毫秒)
+spring.redis.timeout=2000
+

+ 52 - 0
code/h5client-app/src/main/resources/application-prod.properties

@@ -0,0 +1,52 @@
+#### Mysql数据库配置信息(用户数据持久化存储)
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+spring.datasource.url=jdbc:mysql://127.0.0.1:3306/robot_cloud_db.v4_new?serverTimezone=GMT%2B8&characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes&useSSL=false
+#数据库账号
+spring.datasource.username=root
+#数据库访问密码
+spring.datasource.password=Sunwin@123.com
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
+
+#############连接池的配置信息
+# 初始化大小,最小,最大
+spring.datasource.initialSize=5
+spring.datasource.minIdle=5
+spring.datasource.maxActive=20
+# 配置获取连接等待超时的时间
+spring.datasource.maxWait=60000
+# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+spring.datasource.timeBetweenEvictionRunsMillis=60000
+# 配置一个连接在池中最小生存的时间,单位是毫秒
+spring.datasource.minEvictableIdleTimeMillis=300000
+# 配置自动检测一些连接是否有效
+spring.datasource.validationQuery=SELECT 1 FROM DUAL
+spring.datasource.testWhileIdle=true
+spring.datasource.testOnBorrow=false
+spring.datasource.testOnReturn=false
+# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙(不推荐加上)
+spring.datasource.filters=stat
+# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+#spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
+# 合并多个DruidDataSource的监控数据
+spring.datasource.useGlobalDataSourceStat=true
+
+############# 配置redis缓存(高频交互数据临时存储) #####
+#Redis
+# 连接的数据仓库(默认为0)
+spring.redis.database=0
+# redis服务ip
+spring.redis.host=127.0.0.1
+# redis端口号
+spring.redis.port=6379
+# redis密码
+spring.redis.password=sunwin@2021
+# 连接池最大连接数(使用负值表示没有限制)
+#spring.redis.pool.max-active=8
+# 连接池最大阻塞等待时间(使用负值表示没有限制)
+#spring.redis.pool.max-wait=-1
+# 连接池中的最大空闲连接
+#spring.redis.pool.max-idle=8
+# 连接池中的最小空闲连接
+#spring.redis.pool.min-idle=0
+# 连接超时时间(毫秒)
+spring.redis.timeout=2000

+ 51 - 0
code/h5client-app/src/main/resources/application.properties

@@ -1 +1,52 @@
+# 配置项目信息
+server.servlet.context-path=/
+server.port=8089
+# 获取pom文件中project.version值
+version=@project.version@
+
+# 配置数据源
+spring.profiles.active=dev
+
+# 配置时区
+spring.jackson.time-zone=GMT+8
+# 配置文件请求大小设置
+spring.servlet.multipart.max-file-size=50MB
+spring.servlet.multipart.max-request-size=50MB
+
+# page helper分页插件配置
+pagehelper.helperDialect=mysql
+pagehelper.reasonable=true
+pagehelper.supportMethodsArguments=true
+pagehelper.params=count=countSql
+
+# 配置日志
+logging.level.com.sw=debug
+logging.file.path=./logs/pmp
+# ***解决swagger2.9.2版本“@ApiModelProperty”注解“example”属性不填时的报错问题
+logging.level.io.swagger.models.parameters.AbstractSerializableParameter:error
+
+# 配置请求信息
+spring.session.timeout=0
+server.max-http-header-size=1024000
+# thymeleaf的基本配置
+spring.thymeleaf.encoding=UTF-8
+spring.thymeleaf.cache=false
+spring.thymeleaf.mode=HTML
+spring.thymeleaf.servlet.content-type=text/html
+spring.thymeleaf.prefix=classpath:/view/
+spring.thymeleaf.suffix=.html
+
+############# 配置mybatis #############
+# 驼峰转换
+mybatis-plus.configuration.map-underscore-to-camel-case=true
+# 实体类地址
+mybatis-plus.typeAliasesPackage=com.gonghang.h5clientapp.beans.dto
+# xml文件地址
+mybatis-plus.mapper-locations=classpath:/mapper/*.xml
+# 接收null字段
+mybatis-plus.configuration.call-setters-on-nulls=true
+# 删除值
+mybatis-plus.global-config.db-config.logic-delete-value=1
+mybatis-plus.global-config.db-config.logic-not-delete-value=0
+
 

+ 31 - 0
code/h5client-app/src/main/resources/mapper/CheckTaskMapper.xml

@@ -0,0 +1,31 @@
+<?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.gonghang.h5clientapp.dao.CheckTaskMapper">
+
+    <!--    上海工行掌上运维——查询任务列表-->
+    <resultMap id="GhTaskMap" type="java.util.HashMap">
+        <id column="id" jdbcType="INTEGER" property="taskId"/>
+        <result column="task_name" jdbcType="VARCHAR" property="taskName"/>
+        <result column="task_status" jdbcType="TINYINT" property="taskStatus"/>
+        <result column="is_send" jdbcType="TINYINT" property="isSend"/>
+        <result column="create_time" jdbcType="VARCHAR" property="createTime"/>
+    </resultMap>
+    <select id="selectTaskList" resultMap="GhTaskMap">
+        SELECT
+        t.id taskId,
+        t.task_name,
+        t.task_status,
+        IF (t.send_time IS NULL , 0, 1 ) is_send,
+        DATE_FORMAT(t.create_time,'%Y-%c-%d %H:%i:%s') create_time
+        FROM
+        check_task t
+        LEFT JOIN task_data d ON d.task_id = t.id
+        WHERE
+        t.task_status!=3
+        <if test="robotId != null">
+            and d.robot_id =#{robotId}
+        </if>
+        ORDER BY CASE WHEN t.task_status = 1 THEN 0 ELSE 1 END ASC,
+        t.create_time DESC
+    </select>
+</mapper>

+ 29 - 0
code/h5client-app/src/main/resources/mapper/TaskReportMapper.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.gonghang.h5clientapp.dao.TaskReportMapper">
+
+    <!--    上海工行 掌上运维——查询报告列表-->
+    <resultMap id="ReportMap" type="java.util.HashMap">
+        <id column="id" jdbcType="INTEGER" property="reportId"/>
+        <result column="report_name" jdbcType="VARCHAR" property="reportName"/>
+        <result column="status" jdbcType="TINYINT" property="status"/>
+        <result column="create_time" jdbcType="VARCHAR" property="createTime"/>
+    </resultMap>
+    <select id="selectReportList" resultMap="ReportMap">
+        SELECT
+        r.id,
+        r.report_name,
+        r.`status`,
+        DATE_FORMAT(r.create_time,'%Y-%c-%d %H:%i:%s') create_time
+        FROM
+        task_report r
+        LEFT JOIN check_task t ON t.id = r.task_id
+        WHERE
+        1=1
+        <if test="robotId != null">
+            and d.robot_id =#{robotId}
+        </if>
+        ORDER BY
+        r.create_time DESC
+    </select>
+</mapper>