Browse Source

Merge branch 'master' of http://60.171.161.56:20000/tjf/deviceManage

wangmengwei 1 day ago
parent
commit
2eff023b92
24 changed files with 455 additions and 43 deletions
  1. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/manage/ChannelNumberController.java
  2. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/manage/EquipmentManageController.java
  3. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/manage/ParameterSetController.java
  4. 1 1
      ruoyi-admin/src/main/resources/application-druid.yml
  5. 7 9
      ruoyi-admin/src/main/resources/application.yml
  6. 8 0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  7. 18 3
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java
  8. 259 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ChannelNumber.java
  9. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ParameterSet.java
  10. 14 5
      ruoyi-system/src/main/java/com/ruoyi/manage/domain/ChannelNumberVo.java
  11. 16 0
      ruoyi-system/src/main/java/com/ruoyi/manage/domain/EquipmentManage.java
  12. 4 1
      ruoyi-system/src/main/java/com/ruoyi/manage/mapper/ChannelNumberMapper.java
  13. 1 0
      ruoyi-system/src/main/java/com/ruoyi/manage/mapper/EquipmentManageMapper.java
  14. 1 1
      ruoyi-system/src/main/java/com/ruoyi/manage/mapper/ParameterSetMapper.java
  15. 1 1
      ruoyi-system/src/main/java/com/ruoyi/manage/service/IChannelNumberService.java
  16. 1 0
      ruoyi-system/src/main/java/com/ruoyi/manage/service/IEquipmentManageService.java
  17. 1 1
      ruoyi-system/src/main/java/com/ruoyi/manage/service/IParameterSetService.java
  18. 15 2
      ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/ChannelNumberServiceImpl.java
  19. 5 0
      ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/EquipmentManageServiceImpl.java
  20. 1 1
      ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/ParameterSetServiceImpl.java
  21. 9 9
      ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/WarnManageServiceImpl.java
  22. 30 4
      ruoyi-system/src/main/java/com/ruoyi/mqtt/service/MqttMessageListener.java
  23. 12 1
      ruoyi-system/src/main/resources/mapper/manage/ChannelNumberMapper.xml
  24. 47 0
      ruoyi-system/src/main/resources/mapper/manage/EquipmentManageMapper.xml

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/manage/ChannelNumberController.java

@@ -3,10 +3,10 @@ package com.ruoyi.web.controller.manage;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.ChannelNumber;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.manage.domain.ChannelNumber;
 import com.ruoyi.manage.service.IChannelNumberService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/manage/EquipmentManageController.java

@@ -44,7 +44,7 @@ public class EquipmentManageController extends BaseController {
     @PreAuthorize("@ss.hasPermi('manage:equipmentManage:listNoPage')")
     @GetMapping("/listNoPage")
     public TableDataInfo listNoPage(EquipmentManage equipmentManage) {
-        List<EquipmentManage> list = equipmentManageService.selectEquipmentManageList(equipmentManage);
+        List<EquipmentManage> list = equipmentManageService.selectEquipmentManageListTree(equipmentManage);
         return getDataTable(list);
     }
 

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/manage/ParameterSetController.java

@@ -6,7 +6,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.manage.domain.ParameterSet;
+import com.ruoyi.common.core.domain.entity.ParameterSet;
 import com.ruoyi.manage.service.IParameterSetService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;

+ 1 - 1
ruoyi-admin/src/main/resources/application-druid.yml

@@ -17,7 +17,7 @@ ruoyi:
 # 开发环境配置
 server:
     # 服务器的HTTP端口,默认为8080
-    port: 8099
+    port: 8056
     servlet:
         # 应用的访问路径
         context-path: /

+ 7 - 9
ruoyi-admin/src/main/resources/application.yml

@@ -8,7 +8,7 @@ logging:
 user:
   password:
     # 密码最大错误次数
-    maxRetryCount: 5
+    maxRetryCount: 10
     # 密码锁定时间(默认10分钟)
     lockTime: 10
 
@@ -41,7 +41,7 @@ token:
   # 令牌密钥
   secret: abcdefghijklmnopqrstuvwxyz123
   # 令牌有效期(默认30分钟)
-  expireTime: 720
+  expireTime: 7200
 
 # MyBatis配置
 mybatis:
@@ -77,16 +77,14 @@ xss:
 # MQTT配置
 mqtt:
 #  server-uri: tcp://13.229.167.76:1883
-  server-uri: tcp://60.171.161.56:20009
-#  server-uri: tcp://127.0.0.1:1883
+#  server-uri: tcp://60.171.161.56:20009
+  server-uri: tcp://127.0.0.1:1883
 #  server-uri: tcp://192.168.101.147:1883
 #  server-uri: tcp://127.0.0.1:1883
   client-id: JavaClientBoMan
-  username: admin
-  password: 1qaz!QAZ
-#  username:
-#  password:
-  default-topic: toServer_leaveStat,toServer_playStat
+  username:
+  password:
+  default-topic: toServer_leaveStat,toServer_playStat,toServer_picPos
   default-qos: 1
   timeout: 30
   keep-alive: 60

+ 8 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -190,6 +190,14 @@ public class Constants {
     public static final String DETECTION_PLAYRATE = "detection/playrate";
     //rtsp地址
     public static final String DETECTION_RTSP = "detection/rtsp";
+    //离岗告警接收
+    public static final String TO_SERVER_LEAVE_STAT = "toServer_leaveStat";
+    //玩手机告警接收
+    public static final String TO_SERVER_PLAY_STAT = "toServer_playStat";
+    //人员聚集
+    public static final String TO_SERVER_PEO_GATHER = "toServer_peoGather";
+    //获取通道画框图片
+    public static final String TO_SERVER_PIC_POS= "toServer_picPos";
     //首页统计折线图往期年份数据
     public static final String WARN_MANAGE_LAST_YEAR = "warn_manage_last_year:";
 }

+ 18 - 3
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java

@@ -1,14 +1,16 @@
 package com.ruoyi.common.core.domain;
 
-import java.io.Serializable;
-import java.util.List;
-import java.util.stream.Collectors;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.entity.ChannelNumber;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysMenu;
 import com.ruoyi.common.utils.StringUtils;
 
+import java.io.Serializable;
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * Treeselect树结构实体类
  * 
@@ -23,6 +25,10 @@ public class TreeSelect implements Serializable
 
     /** 节点名称 */
     private String label;
+    /**
+     * 多级节点名称
+     */
+    private String labelTwo;
 
     /** 节点禁用 */
     private boolean disabled = false;
@@ -51,6 +57,15 @@ public class TreeSelect implements Serializable
         this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
     }
 
+    public TreeSelect(ChannelNumber channelNumber)
+    {
+        this.id = channelNumber.getChannelId();
+        this.label = channelNumber.getEquipmentName();
+        this.labelTwo = channelNumber.getChannelNum();
+        this.children = channelNumber.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
+    }
+
+
     public Long getId()
     {
         return id;

+ 259 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ChannelNumber.java

@@ -0,0 +1,259 @@
+package com.ruoyi.common.core.domain.entity;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import javax.validation.constraints.NotNull;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 通道管理对象 channel_number
+ *
+ * @author boman
+ * @date 2025-05-07
+ */
+public class ChannelNumber extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 通道ID
+     */
+    private Long channelId;
+    /**
+     * 设备Ip
+     */
+    private String equipmentIp;
+    /**
+     * 设备ID
+     */
+    @NotNull
+    private Long equipmentId;
+    /**
+     * 设备编号
+     */
+    @Excel(name = "设备编号")
+    private String equipmentNum;
+
+    /**
+     * 设备名称
+     */
+    @Excel(name = "设备名称")
+    private String equipmentName;
+    /**
+     * 通道编号
+     */
+    @Excel(name = "通道编号")
+    @NotNull
+    private String channelNum;
+
+    /**
+     * 预览端口
+     */
+    private String port;
+
+    /**
+     * 视频地址
+     */
+    @Excel(name = "视频地址")
+    private String videoAddress;
+    @Excel(name = "图片地址摄像头")
+    private String photoAddress;
+    /**
+     * 账号
+     */
+    private String account;
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * 探测协议类型
+     */
+    @Excel(name = "探测协议类型")
+    private String protocolType;
+
+    /**
+     * 通道描述
+     */
+    @Excel(name = "通道描述")
+    private String channelDetails;
+
+    /**
+     * 删除标志(0代表存在 1代表删除)
+     */
+    private String delFlag;
+    /**
+     * 是否设置过参数 N Y 不在数据库中
+     */
+    private String isChannel;
+
+    /**
+     * 参数设置
+     */
+    private ParameterSet parameterSet;
+
+    /** 子菜单 */
+    private List<ChannelNumber> children = new ArrayList<ChannelNumber>();
+
+
+    public List<ChannelNumber> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<ChannelNumber> children) {
+        this.children = children;
+    }
+
+    public String getPhotoAddress() {
+        return photoAddress;
+    }
+
+    public void setPhotoAddress(String photoAddress) {
+        this.photoAddress = photoAddress;
+    }
+
+    public String getEquipmentIp() {
+        return equipmentIp;
+    }
+
+    public void setEquipmentIp(String equipmentIp) {
+        this.equipmentIp = equipmentIp;
+    }
+
+    public ParameterSet getParameterSet() {
+        return parameterSet;
+    }
+
+    public void setParameterSet(ParameterSet parameterSet) {
+        this.parameterSet = parameterSet;
+    }
+
+    public String getPort() {
+        return port;
+    }
+
+    public void setPort(String port) {
+        this.port = port;
+    }
+
+    public String getIsChannel() {
+        return isChannel;
+    }
+
+    public void setIsChannel(String isChannel) {
+        this.isChannel = isChannel;
+    }
+
+    public String getEquipmentNum() {
+        return equipmentNum;
+    }
+
+    public void setEquipmentNum(String equipmentNum) {
+        this.equipmentNum = equipmentNum;
+    }
+
+    public String getEquipmentName() {
+        return equipmentName;
+    }
+
+    public void setEquipmentName(String equipmentName) {
+        this.equipmentName = equipmentName;
+    }
+
+    public Long getEquipmentId() {
+        return equipmentId;
+    }
+
+    public void setEquipmentId(Long equipmentId) {
+        this.equipmentId = equipmentId;
+    }
+
+    public String getAccount() {
+        return account;
+    }
+
+    public void setAccount(String account) {
+        this.account = account;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public void setChannelId(Long channelId) {
+        this.channelId = channelId;
+    }
+
+    public Long getChannelId() {
+        return channelId;
+    }
+
+    public void setChannelNum(String channelNum) {
+        this.channelNum = channelNum;
+    }
+
+    public String getChannelNum() {
+        return channelNum;
+    }
+
+    public void setVideoAddress(String videoAddress) {
+        this.videoAddress = videoAddress;
+    }
+
+    public String getVideoAddress() {
+        return videoAddress;
+    }
+
+    public void setProtocolType(String protocolType) {
+        this.protocolType = protocolType;
+    }
+
+    public String getProtocolType() {
+        return protocolType;
+    }
+
+    public void setChannelDetails(String channelDetails) {
+        this.channelDetails = channelDetails;
+    }
+
+    public String getChannelDetails() {
+        return channelDetails;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return "ChannelNumber{" +
+                "channelId=" + channelId +
+                ", equipmentIp='" + equipmentIp + '\'' +
+                ", equipmentId=" + equipmentId +
+                ", equipmentNum='" + equipmentNum + '\'' +
+                ", equipmentName='" + equipmentName + '\'' +
+                ", channelNum='" + channelNum + '\'' +
+                ", port='" + port + '\'' +
+                ", videoAddress='" + videoAddress + '\'' +
+                ", photoAddress='" + photoAddress + '\'' +
+                ", account='" + account + '\'' +
+                ", password='" + password + '\'' +
+                ", protocolType='" + protocolType + '\'' +
+                ", channelDetails='" + channelDetails + '\'' +
+                ", delFlag='" + delFlag + '\'' +
+                ", isChannel='" + isChannel + '\'' +
+                ", parameterSet=" + parameterSet +
+                ", children=" + children +
+                '}';
+    }
+}

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/manage/domain/ParameterSet.java → ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ParameterSet.java

@@ -1,4 +1,4 @@
-package com.ruoyi.manage.domain;
+package com.ruoyi.common.core.domain.entity;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;

+ 14 - 5
ruoyi-system/src/main/java/com/ruoyi/manage/domain/ChannelNumber.java → ruoyi-system/src/main/java/com/ruoyi/manage/domain/ChannelNumberVo.java

@@ -2,8 +2,7 @@ package com.ruoyi.manage.domain;
 
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
-
-import javax.validation.constraints.NotNull;
+import com.ruoyi.common.core.domain.entity.ParameterSet;
 
 /**
  * 通道管理对象 channel_number
@@ -11,7 +10,7 @@ import javax.validation.constraints.NotNull;
  * @author boman
  * @date 2025-05-07
  */
-public class ChannelNumber extends BaseEntity {
+public class ChannelNumberVo extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /**
@@ -25,7 +24,7 @@ public class ChannelNumber extends BaseEntity {
     /**
      * 设备ID
      */
-    @NotNull
+
     private Long equipmentId;
     /**
      * 设备编号
@@ -42,7 +41,6 @@ public class ChannelNumber extends BaseEntity {
      * 通道编号
      */
     @Excel(name = "通道编号")
-    @NotNull
     private String channelNum;
 
     /**
@@ -55,6 +53,8 @@ public class ChannelNumber extends BaseEntity {
      */
     @Excel(name = "视频地址")
     private String videoAddress;
+    @Excel(name = "图片地址摄像头")
+    private String photoAddress;
     /**
      * 账号
      */
@@ -90,6 +90,14 @@ public class ChannelNumber extends BaseEntity {
      */
     private ParameterSet parameterSet;
 
+    public String getPhotoAddress() {
+        return photoAddress;
+    }
+
+    public void setPhotoAddress(String photoAddress) {
+        this.photoAddress = photoAddress;
+    }
+
     public String getEquipmentIp() {
         return equipmentIp;
     }
@@ -221,6 +229,7 @@ public class ChannelNumber extends BaseEntity {
                 ", channelNum='" + channelNum + '\'' +
                 ", port='" + port + '\'' +
                 ", videoAddress='" + videoAddress + '\'' +
+                ", photoAddress='" + photoAddress + '\'' +
                 ", account='" + account + '\'' +
                 ", password='" + password + '\'' +
                 ", protocolType='" + protocolType + '\'' +

+ 16 - 0
ruoyi-system/src/main/java/com/ruoyi/manage/domain/EquipmentManage.java

@@ -3,9 +3,12 @@ package com.ruoyi.manage.domain;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import com.ruoyi.common.core.domain.entity.ChannelNumber;
 
 import javax.validation.constraints.NotNull;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 设备管理对象 equipment_manage
@@ -65,6 +68,18 @@ public class EquipmentManage extends BaseEntity
     /** 部门名称 */
     private String deptName;
 
+    /** 子菜单 */
+    private List<ChannelNumber> children = new ArrayList<ChannelNumber>();
+
+
+    public List<ChannelNumber> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<ChannelNumber> children) {
+        this.children = children;
+    }
+
     public Long getDeptId() {
         return deptId;
     }
@@ -205,6 +220,7 @@ public class EquipmentManage extends BaseEntity
                 ", delFlag='" + delFlag + '\'' +
                 ", deptId=" + deptId +
                 ", deptName='" + deptName + '\'' +
+                ", children=" + children +
                 '}';
     }
 }

+ 4 - 1
ruoyi-system/src/main/java/com/ruoyi/manage/mapper/ChannelNumberMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.manage.mapper;
 
-import com.ruoyi.manage.domain.ChannelNumber;
+import com.ruoyi.common.core.domain.entity.ChannelNumber;
+import com.ruoyi.manage.domain.ChannelNumberVo;
+
 import java.util.List;
 
 /**
@@ -43,6 +45,7 @@ public interface ChannelNumberMapper
      * @return 结果
      */
     public int updateChannelNumber(ChannelNumber channelNumber);
+    public int updateChannelNumberByChannelId(ChannelNumberVo channelNumber);
 
     /**
      * 删除通道管理

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/manage/mapper/EquipmentManageMapper.java

@@ -27,6 +27,7 @@ public interface EquipmentManageMapper
      * @return 设备管理集合
      */
     public List<EquipmentManage> selectEquipmentManageList(EquipmentManage equipmentManage);
+    public List<EquipmentManage> selectEquipmentManageListTree(EquipmentManage equipmentManage);
     public EquipmentManage selectEquipmentManageByEquipmentIp(EquipmentManage equipmentManage);
 
     /**

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/manage/mapper/ParameterSetMapper.java

@@ -1,6 +1,6 @@
 package com.ruoyi.manage.mapper;
 
-import com.ruoyi.manage.domain.ParameterSet;
+import com.ruoyi.common.core.domain.entity.ParameterSet;
 
 import java.util.List;
 

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/manage/service/IChannelNumberService.java

@@ -1,7 +1,7 @@
 package com.ruoyi.manage.service;
 
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.manage.domain.ChannelNumber;
+import com.ruoyi.common.core.domain.entity.ChannelNumber;
 
 import java.util.List;
 

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/manage/service/IEquipmentManageService.java

@@ -28,6 +28,7 @@ public interface IEquipmentManageService
      * @return 设备管理集合
      */
     public List<EquipmentManage> selectEquipmentManageList(EquipmentManage equipmentManage);
+    public List<EquipmentManage> selectEquipmentManageListTree(EquipmentManage equipmentManage);
 
     /**
      * 新增设备管理

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/manage/service/IParameterSetService.java

@@ -1,7 +1,7 @@
 package com.ruoyi.manage.service;
 
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.manage.domain.ParameterSet;
+import com.ruoyi.common.core.domain.entity.ParameterSet;
 
 import java.util.List;
 

+ 15 - 2
ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/ChannelNumberServiceImpl.java

@@ -1,11 +1,12 @@
 package com.ruoyi.manage.service.impl;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.ChannelNumber;
+import com.ruoyi.common.core.domain.entity.ParameterSet;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.manage.domain.ChannelNumber;
+import com.ruoyi.manage.domain.ChannelNumberVo;
 import com.ruoyi.manage.domain.EquipmentManage;
-import com.ruoyi.manage.domain.ParameterSet;
 import com.ruoyi.manage.mapper.ChannelNumberMapper;
 import com.ruoyi.manage.mapper.EquipmentManageMapper;
 import com.ruoyi.manage.mapper.ParameterSetMapper;
@@ -116,6 +117,18 @@ public class ChannelNumberServiceImpl implements IChannelNumberService {
         return AjaxResult.success();
     }
 
+
+    /**
+     * 修改通道管理
+     *
+     * @param channelNumber 通道管理
+     * @return 结果
+     */
+
+    public void updateChannelNumberByChannelId(ChannelNumberVo channelNumber) {
+        channelNumberMapper.updateChannelNumberByChannelId(channelNumber);
+    }
+
     /**
      * 修改通道管理
      *

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/EquipmentManageServiceImpl.java

@@ -43,6 +43,11 @@ public class EquipmentManageServiceImpl implements IEquipmentManageService {
         return equipmentManageMapper.selectEquipmentManageList(equipmentManage);
     }
 
+    @Override
+    public List<EquipmentManage> selectEquipmentManageListTree(EquipmentManage equipmentManage) {
+        return equipmentManageMapper.selectEquipmentManageListTree(equipmentManage);
+    }
+
     /**
      * 新增设备管理
      *

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/ParameterSetServiceImpl.java

@@ -3,7 +3,7 @@ package com.ruoyi.manage.service.impl;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.manage.domain.ParameterSet;
+import com.ruoyi.common.core.domain.entity.ParameterSet;
 import com.ruoyi.manage.mapper.ParameterSetMapper;
 import com.ruoyi.manage.service.IParameterSetService;
 import com.ruoyi.mqtt.service.MqttService;

+ 9 - 9
ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/WarnManageServiceImpl.java

@@ -144,20 +144,20 @@ public class WarnManageServiceImpl implements IWarnManageService {
                 }
             }
             //插入当月部门数据
-            Map<Long, List<WarnManage>> deptNameCollect = warnManages.stream().filter( e ->e.getDeptId() != null).collect(Collectors.groupingBy(WarnManage::getDeptId));
+            Map<Long, List<WarnManage>> deptNameCollect = warnManages.stream().filter(e -> e.getDeptId() != null).collect(Collectors.groupingBy(WarnManage::getDeptId));
             List<Map<String, Object>> finalDeptNameMapList = new ArrayList<>();
             deptNameCollect.forEach((deptId, v) -> {
                 Map<String, Object> deptMap = new HashMap<>(3);
                 deptMap.put("deptName", v.get(0).getDeptName());
                 deptMap.put("warnNum", String.valueOf(v.size()));
-                deptMap.put("deptId", deptId);
+                deptMap.put("deptId", deptId.toString());
                 finalDeptNameMapList.add(deptMap);
             });
             deptNameMapList = finalDeptNameMapList;
         }
 
         //上月告警数据
-        Map<String, Object> warnLastMonth = redisCache.getCacheMap(WARN_LAST_MONTH + DateUtils.getMonth());
+        Map<String, Object> warnLastMonth = redisCache.getCacheMap(WARN_LAST_MONTH + DateUtils.getLastMonth());
         if (warnLastMonth.isEmpty()) {
             Map<String, Object> lastMap = new HashMap<>();
             //从数据库查询
@@ -177,13 +177,13 @@ public class WarnManageServiceImpl implements IWarnManageService {
                     }
                 }
                 //插入上月部门数据
-                Map<Long, List<WarnManage>> deptNameCollect = warnManagesLast.stream().filter( e ->e.getDeptId() != null).collect(Collectors.groupingBy(WarnManage::getDeptId));
+                Map<Long, List<WarnManage>> deptNameCollect = warnManagesLast.stream().filter(e -> e.getDeptId() != null).collect(Collectors.groupingBy(WarnManage::getDeptId));
                 List<Map<String, Object>> finalDeptNameLastMapList = new ArrayList<>();
                 deptNameCollect.forEach((deptId, v) -> {
                     Map<String, Object> deptMap = new HashMap<>(3);
                     deptMap.put("deptName", v.get(0).getDeptName());
                     deptMap.put("warnNum", String.valueOf(v.size()));
-                    deptMap.put("deptId", deptId);
+                    deptMap.put("deptId", deptId.toString());
                     finalDeptNameLastMapList.add(deptMap);
                 });
                 deptNameLastMapList = finalDeptNameLastMapList;
@@ -192,7 +192,7 @@ public class WarnManageServiceImpl implements IWarnManageService {
             lastMap.put("warnMonthLastAll", warnMonthLastAll);
             lastMap.put("warnMonthLastLeave", warnMonthLastLeave);
             lastMap.put("warnMonthLastPlay", warnMonthLastPlay);
-            redisCache.setCacheMap(WARN_LAST_MONTH + DateUtils.getMonth(), lastMap);
+            redisCache.setCacheMap(WARN_LAST_MONTH + DateUtils.getLastMonth(), lastMap);
         } else {
             warnMonthLastAll = Integer.parseInt(warnLastMonth.get("warnMonthLastAll").toString());
             warnMonthLastLeave = Integer.parseInt(warnLastMonth.get("warnMonthLastLeave").toString());
@@ -209,8 +209,8 @@ public class WarnManageServiceImpl implements IWarnManageService {
                 String warnNumLast = "0";
                 if (!finalDeptNameMapList.isEmpty()) {
                     for (Map<String, Object> lastMonthDeptMap : finalDeptNameMapList) {
-                        String deptIdLast = lastMonthDeptMap.get(deptId).toString();
-                        if (StringUtils.isNotEmpty(deptIdLast)) {
+                        String deptIdLast = lastMonthDeptMap.get(("deptId")).toString();
+                        if (deptId.equals(deptIdLast)) {
                             warnNumLast = lastMonthDeptMap.get("warnNum").toString();
                         }
                     }
@@ -394,7 +394,7 @@ public class WarnManageServiceImpl implements IWarnManageService {
             Long channelId = jsonObject.getLong("channelId");
             String parameterSet = jsonObject.getString("parameterSet");
             String algorithmResult = jsonObject.getString("algorithmResult");
-            String photoUrl = jsonObject.getString("photoUrl");
+            String photoUrl = "http://114.99.51.58:15010/prod-api/profile" + jsonObject.getString("photoUrl");
             String videoUrl = jsonObject.getString("videoUrl");
             String rangName = jsonObject.getString("name");
             WarnManage warnManage = new WarnManage();

+ 30 - 4
ruoyi-system/src/main/java/com/ruoyi/mqtt/service/MqttMessageListener.java

@@ -1,12 +1,17 @@
 package com.ruoyi.mqtt.service;
 
 import com.ruoyi.common.model.MqttMessage;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.manage.domain.ChannelNumberVo;
+import com.ruoyi.manage.service.impl.ChannelNumberServiceImpl;
 import com.ruoyi.manage.service.impl.WarnManageServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.EventListener;
 import org.springframework.stereotype.Component;
 
+import static com.ruoyi.common.constant.Constants.*;
+
 /**
  * MQTT消息监听器
  *
@@ -23,6 +28,8 @@ public class MqttMessageListener {
 
     @Autowired
     private WarnManageServiceImpl warnManageService;
+    @Autowired
+    private ChannelNumberServiceImpl channelNumberService;
 
 
     /**
@@ -47,13 +54,32 @@ public class MqttMessageListener {
           "videoUrl":"违规视频URL"
          }
          */
-        if(message.getTopic().equals("toServer_leaveStat")){
+        if(message.getTopic().equals(TO_SERVER_LEAVE_STAT)){
             //插入告警信息
-            warnManageService.addWarnManage(message,"0");
+            warnManageService.addWarnManage(message,ZERO);
         }
-        else if(message.getTopic().equals("toServer_playStat")){
+        else if(message.getTopic().equals(TO_SERVER_PLAY_STAT)){
             //插入告警信息
-            warnManageService.addWarnManage(message,"1");
+            warnManageService.addWarnManage(message,ONE);
+        }else if(message.getTopic().equals(TO_SERVER_PEO_GATHER)){
+            //插入告警信息
+            warnManageService.addWarnManage(message,TWO);
+        }
+        else if(message.getTopic().equals(TO_SERVER_PIC_POS)){
+            try {
+                //返回值为photoAddress_channelId
+                String payload = message.getPayload();
+                if (StringUtils.isNotEmpty(payload)) {
+                    String[] messageResult = payload.split("_");
+                    //插入通道画框图片
+                    ChannelNumberVo channelNumber = new ChannelNumberVo();
+                    channelNumber.setChannelId(Long.valueOf(messageResult[0]));
+                    channelNumber.setPhotoAddress(messageResult[1]);
+                    channelNumberService.updateChannelNumberByChannelId(channelNumber);
+                }
+            } catch (NumberFormatException e) {
+                log.info("新增通道画框异常:{}", e.getMessage());
+            }
         }
 
         // 例如:解析JSON消息内容,更新数据库,触发其他操作等

+ 12 - 1
ruoyi-system/src/main/resources/mapper/manage/ChannelNumberMapper.xml

@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="channelNum"    column="channel_num"    />
         <result property="port"    column="port"    />
         <result property="videoAddress"    column="video_address"    />
+        <result property="photoAddress"    column="photo_address"    />
         <result property="account"    column="account"    />
         <result property="password"    column="password"    />
         <result property="protocolType"    column="protocol_type"    />
@@ -25,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectChannelNumberVo">
-        select channel_id, channel_num,equipment_id, equipment_num, equipment_name, video_address,port, account,password,protocol_type, channel_details, del_flag, create_by, create_time, update_by, update_time, remark from channel_number
+        select channel_id, channel_num,equipment_id, equipment_num, equipment_name, video_address,photo_address,port, account,password,protocol_type, channel_details, del_flag, create_by, create_time, update_by, update_time, remark from channel_number
     </sql>
 
     <select id="selectChannelNumberList" parameterType="ChannelNumber" resultMap="ChannelNumberResult">
@@ -61,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="equipmentName != null">equipment_name,</if>
             <if test="channelNum != null">channel_num,</if>
             <if test="videoAddress != null">video_address,</if>
+            <if test="photoAddress != null">photo_address,</if>
             <if test="account != null">account,</if>
             <if test="port != null">port,</if>
             <if test="password != null">password,</if>
@@ -79,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="equipmentName != null">#{equipmentName},</if>
             <if test="channelNum != null">#{channelNum},</if>
             <if test="videoAddress != null">#{videoAddress},</if>
+            <if test="photoAddress != null">#{photoAddress},</if>
             <if test="account != null">#{account},</if>
             <if test="port != null">#{port},</if>
             <if test="password != null">#{password},</if>
@@ -101,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="equipmentName != null">equipment_name = #{equipmentName},</if>
             <if test="channelNum != null">channel_num = #{channelNum},</if>
             <if test="videoAddress != null">video_address = #{videoAddress},</if>
+            <if test="photoAddress != null">photo_address = #{photoAddress},</if>
             <if test="account != null">account = #{account},</if>
             <if test="port != null">port = #{port},</if>
             <if test="password != null">password = #{password},</if>
@@ -115,6 +119,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
         where channel_id = #{channelId}
     </update>
+    <update id="updateChannelNumberByChannelId" parameterType="channelNumberVo">
+        update channel_number
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="photoAddress != null">photo_address = #{photoAddress},</if>
+        </trim>
+        where channel_id = #{channelId}
+    </update>
 
     <delete id="deleteChannelNumberByChannelId" parameterType="Long">
         delete from channel_number where channel_id = #{channelId}

+ 47 - 0
ruoyi-system/src/main/resources/mapper/manage/EquipmentManageMapper.xml

@@ -23,6 +23,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
+        <collection  property="children"   javaType="java.util.List"  resultMap="ChannelNumberResult" />
+    </resultMap>
+
+    <resultMap type="ChannelNumber" id="ChannelNumberResult">
+        <result property="channelId"    column="channel_id"    />
+        <result property="equipmentId"    column="c_equipment_id"    />
+        <result property="equipmentNum"    column="c_equipment_num"    />
+        <result property="equipmentName"    column="c_equipment_name"    />
+        <result property="channelNum"    column="channel_num"    />
+        <result property="port"    column="port"    />
+        <result property="videoAddress"    column="video_address"    />
+        <result property="photoAddress"    column="photo_address"    />
+        <result property="account"    column="account"    />
+        <result property="password"    column="password"    />
+        <result property="protocolType"    column="protocol_type"    />
+        <result property="channelDetails"    column="channel_details"    />
     </resultMap>
 
     <sql id="selectEquipmentManageVo">
@@ -65,6 +81,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by create_time DESC
     </select>
 
+
+    <select id="selectEquipmentManageListTree" parameterType="EquipmentManage" resultMap="EquipmentManageResult">
+        select e.equipment_id,
+        e.equipment_ip,
+        e.equipment_num,
+        e.equipment_name,
+        e.equipment_type,
+        e.equipment_address,
+        e.equipment_region,
+        e.equipment_time,
+        e.equipment_image,
+        e.run_state,
+        e.dept_id,
+        e.dept_name,
+        e.del_flag,
+        e.create_by,
+        e.create_time,
+        e.update_by,
+        e.update_time,
+        e.remark,
+        c.channel_id, c.channel_num, c.video_address,c.photo_address,port,
+        c.account,c.password,c.protocol_type, c.channel_details
+        from equipment_manage e left join channel_number c on e.equipment_id = c.equipment_id
+        <where>
+                e.del_flag = '0' and c.del_flag = '0'
+            <if test="equipmentName != null  and equipmentName != ''">and e.equipment_name like concat('%',
+                #{equipmentName}, '%')
+            </if>
+        </where>
+    </select>
+
     <select id="selectEquipmentManageByEquipmentIp" parameterType="EquipmentManage" resultMap="EquipmentManageResult">
         <include refid="selectEquipmentManageVo"/>
         <where>