Quellcode durchsuchen

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

wangmengwei vor 1 Tag
Ursprung
Commit
f2efe0af5b

+ 4 - 0
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java

@@ -3,12 +3,16 @@ package com.ruoyi;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 /**
  * 启动程序
  * 
  * @author ruoyi
  */
+@EnableAsync
+@EnableScheduling
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
 public class RuoYiApplication
 {

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

@@ -17,7 +17,7 @@ ruoyi:
 # 开发环境配置
 server:
     # 服务器的HTTP端口,默认为8080
-    port: 8056
+    port: 8057
     servlet:
         # 应用的访问路径
         context-path: /
@@ -39,7 +39,7 @@ spring:
 #        port: 20001
         port: 6379
         # 数据库索引
-        database: 10
+        database: 9
         # 密码
 #        password: Boman123
         password: 123456
@@ -113,4 +113,21 @@ spring:
                     merge-sql: true
                 wall:
                     config:
-                        multi-statement-allow: true
+                        multi-statement-allow: true
+# 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://192.168.101.147:1883
+    #  server-uri: tcp://127.0.0.1:1883
+    client-id: JavaClientBoManDev
+    username:
+    password:
+    default-topic: toServer_leaveStat,toServer_playStat,toServer_picPos,toServer_workStat
+    default-qos: 1
+    timeout: 30
+    keep-alive: 60
+    clean-session: true
+    auto-reconnect: true
+    command-timeout: 10

+ 17 - 0
ruoyi-admin/src/main/resources/application-prod.yml

@@ -114,3 +114,20 @@ spring:
                 wall:
                     config:
                         multi-statement-allow: true
+# 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://192.168.101.147:1883
+    #  server-uri: tcp://127.0.0.1:1883
+    client-id: JavaClientBoMan
+    username:
+    password:
+    default-topic: toServer_leaveStat,toServer_playStat,toServer_picPos,toServer_workStat
+    default-qos: 1
+    timeout: 30
+    keep-alive: 60
+    clean-session: true
+    auto-reconnect: true
+    command-timeout: 10

+ 0 - 18
ruoyi-admin/src/main/resources/application.yml

@@ -73,21 +73,3 @@ xss:
   excludes: /system/notice,/new/news,/new/news/put
   # 匹配链接
   urlPatterns: /system/*,/monitor/*,/tool/*
-
-# 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://192.168.101.147:1883
-#  server-uri: tcp://127.0.0.1:1883
-  client-id: JavaClientBoMan
-  username:
-  password:
-  default-topic: toServer_leaveStat,toServer_playStat,toServer_picPos,toServer_workStat
-  default-qos: 1
-  timeout: 30
-  keep-alive: 60
-  clean-session: true
-  auto-reconnect: true
-  command-timeout: 10

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/manage/domain/WarnManage.java

@@ -63,8 +63,8 @@ public class WarnManage extends BaseEntity
     private String reportStatus;
 
     /** 告警时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "告警时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "告警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date warnTime;
 
     /** 删除标志(0代表存在 1代表删除) */

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

@@ -12,6 +12,7 @@ import com.ruoyi.manage.mapper.EquipmentManageMapper;
 import com.ruoyi.manage.mapper.WarnManageMapper;
 import com.ruoyi.manage.service.IWarnManageService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -385,6 +386,7 @@ public class WarnManageServiceImpl implements IWarnManageService {
      */
     public void addWarnManage(MqttMessage message, String algorithmType) {
         try {
+            WarnManage warnManage = new WarnManage();
             String payload = message.getPayload();
             JSONObject jsonObject = JSONObject.parseObject(payload);
             String equipmentIp = jsonObject.getString("equipmentIp");
@@ -394,22 +396,28 @@ public class WarnManageServiceImpl implements IWarnManageService {
             Long channelId = jsonObject.getLong("channelId");
             String parameterSet = jsonObject.getString("parameterSet");
             String algorithmResult = jsonObject.getString("algorithmResult");
-            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();
+            if (StringUtils.isNotEmpty(jsonObject.getString("photoUrl"))) {
+                String photoUrl = "http://114.99.51.58:15000/prod-api" + jsonObject.getString("photoUrl");
+                warnManage.setWarnImage(photoUrl);
+            }
+            if (StringUtils.isNotEmpty(jsonObject.getString("videoUrl"))) {
+                warnManage.setVideoAddress("http://114.99.51.58:15000/prod-api" + jsonObject.getString("videoUrl"));
+            }
+            if (StringUtils.isNotEmpty(jsonObject.getString("name"))) {
+                warnManage.setRangName(jsonObject.getString("name"));
+            }
             warnManage.setEquipmentIp(equipmentIp);
-            warnManage.setEquipmentName(equipmentManageOld.getEquipmentName());
-            warnManage.setEquipmentId(equipmentManageOld.getEquipmentId());
+            warnManage.setEquipmentName("未知设备");
+            if (ObjectUtils.isNotEmpty(equipmentManageOld)) {
+                warnManage.setEquipmentName(equipmentManageOld.getEquipmentName());
+                warnManage.setEquipmentId(equipmentManageOld.getEquipmentId());
+            }
             warnManage.setChannelId(channelId);
             warnManage.setParameterSet(parameterSet);
             warnManage.setAlgorithmType(algorithmType);
             warnManage.setReportStatus(algorithmResult);
-            warnManage.setVideoAddress(videoUrl);
-            warnManage.setWarnImage(photoUrl);
             warnManage.setCreateTime(DateUtils.getNowDate());
             warnManage.setWarnTime(DateUtils.getNowDate());
-            warnManage.setRangName(rangName);
             warnManageMapper.insertWarnManage(warnManage);
         } catch (Exception e) {
             log.info("新增告警信息异常:{}", e.getMessage());

+ 3 - 1
ruoyi-system/src/main/java/com/ruoyi/mqtt/service/MqttMessageListener.java

@@ -1,5 +1,6 @@
 package com.ruoyi.mqtt.service;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.model.MqttMessage;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.manage.domain.ChannelNumberVo;
@@ -70,7 +71,8 @@ public class MqttMessageListener {
                 //返回值为photoAddress_channelId
                 String payload = message.getPayload();
                 if (StringUtils.isNotEmpty(payload)) {
-                    String[] messageResult = payload.split("_");
+                    JSONObject jsonObject = JSONObject.parseObject(payload);
+                    String[] messageResult = jsonObject.get("rtsp").toString().split("#");
                     //插入通道画框图片
                     ChannelNumberVo channelNumber = new ChannelNumberVo();
                     channelNumber.setChannelId(Long.valueOf(messageResult[0]));

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/Task.java

@@ -34,7 +34,8 @@ public class Task {
      * 查询是否是节假日
      */
     @Async
-    @Scheduled(cron = "0 01 12 * * ? ")
+    //@Scheduled(cron = "0 30 18 * * ? ")
+    @Scheduled(cron = "0 1 0 * * ? ")
     public void thirdNucleicAcid() {
         String data = DateUtils.getDate();
         //判断当天天是否是法定节假日  0 上班 1周末 2节假日

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

@@ -105,7 +105,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         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>