瀏覽代碼

Merge remote-tracking branch 'origin/20210716' into 20210716

hym 3 年之前
父節點
當前提交
eed6bab1ea

+ 5 - 3
message/src/main/resources/mapper/MessageMapper.xml

@@ -21,6 +21,8 @@
         <result property="uniqueFlag" column="unique_flag" jdbcType="INTEGER"/>
         <result property="dateUpdate" column="date_update" jdbcType="TIMESTAMP"/>
         <result property="appId" column="app_id" jdbcType="TIMESTAMP"/>
+        <result property="sceneType" column="scene_type" jdbcType="TIMESTAMP"/>
+
     </resultMap>
 
     <!-- 基本字段 -->
@@ -192,7 +194,7 @@
     </select>
     <select id="selectPage" resultMap="MessageMap">
         select
-        <include refid="Base_Column_List"/>,b.type typeName,b.path,b.id typeId,b.app_id
+        <include refid="Base_Column_List"/>,b.type typeName,b.path,b.id typeId,b.app_id,a.scene_type
         from uims_message a join uims_message_type b on a.message_type=b.id
         <where>
              a.status=1
@@ -249,7 +251,7 @@
         order by a.date_create desc
     </select>
     <select id="queryLastMessage" resultType="com.zcxk.entity.Message">
-        select a.date_create,a.message_content,b.short_name,b.path,b.id typeId,a.url,
+        select a.date_create,a.message_content,b.short_name,b.path,b.id typeId,a.url,a.scene_type,
                b.type typeName,b.app_id
         from uims_message a
             join uims_message_type b
@@ -262,7 +264,7 @@
     </select>
 
     <select id="queryLastMessageBySceneType" resultType="com.zcxk.entity.Message">
-        select a.date_create,a.message_content,b.short_name,b.path,b.id typeId,a.url,
+        select a.date_create,a.message_content,b.short_name,b.path,b.id typeId,a.url,a.scene_type,
         b.type typeName,b.app_id
         from uims_message a
         join uims_message_type b

+ 2 - 0
zoniot-water/zoniot-water-core/src/main/java/com/bz/zoneiot/water/core/entity/DataAlarmDetailEntity.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.bz.zoneiot.core.utils.encrypt.Md5;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.ToString;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -16,6 +17,7 @@ import java.util.Date;
  **/
 @Data
 @TableName("sms_data_alarm_detail")
+@ToString
 public class DataAlarmDetailEntity extends DataAlarmSetting {
 
     @ApiModelProperty(value = "报警管理ID")

+ 3 - 8
zoniot-water/zoniot-water-core/src/main/java/com/bz/zoneiot/water/core/mapper/OnlineMonitorMapper.xml

@@ -639,14 +639,10 @@
     </select>
     <!--查询管网地图图层及设备-->
     <select id="selectPipeNetLayer" resultMap="layerMap">
-        select t4.id scene_id,t4.scene_name,t5.scene_type_name,t6.id device_id,t6.device_code,t6.device_name,t6.point_x,t6.point_y,t6.address,concat(t12.operator,cast(t12.value as char)+0) alarm_range
+        select t4.id scene_id,t4.scene_name,t5.scene_type_name,t6.id device_id,t6.device_code,t6.device_name,t6.point_x,t6.point_y,t6.address,
+        (select GROUP_CONCAT(t12.relation , ' ',t12.operator,' ',t12.value, ' ' SEPARATOR '') as `alarm_range` from sms_alarm_rule t12 where t12.alarm_type_id = t11.id) alarm_range
         ,t8.attribute_id ,ifnull(t8.remark, t9.`name`) attribute_name,t9.unit,case when t8.attribute_id is null then null when t10.id is null then 0 else 1 end is_alarm
-        <if test="flag == null or flag ==0">
-            ,if (t7.alarm_count>0, 1, 0) device_state
-        </if>
-        <if test="flag == 1">
-            ,case when t7.offline_alarm_count>0 then 2 when t7.alarm_count>0 then 1 else 0 end device_state
-        </if>
+        ,t6.ENABLE_STATE device_state
         from sms_scene t1
         <include refid="deviceInnerJoins"/>
         left join(
@@ -664,7 +660,6 @@
         left join sms_device_attribute t9 on t8.attribute_id=t9.id and t9.status = 1
         left join sms_alarm_details t10 on t10.scene_id=t2.scene_id and t10.device_id=t2.device_id and t10.attribute_id=t8.attribute_id and t10.status = 1 and t10.state=1
         left join sms_alarm_type t11 on t10.ALARM_ID=t11.id and t11.status = 1
-        left join sms_alarm_rule t12 on t12.alarm_type_id=t11.id and t12.status = 1
         where t1.parent_scene_id = 0 and t1. status = 1 and t1. enable_state = 1 and t3.scene_type_name = '管网'
         <choose>
             <when test="sceneTypeName != null and sceneTypeName !=''">

+ 4 - 4
zoniot-water/zoniot-water-web/src/main/java/com/bz/zoneiot/water/web/config/MessageConfig.java

@@ -25,25 +25,25 @@ public class MessageConfig {
     /**
      * 水源告警消息跳转链接
      */
-    @Value("${message.water.source.skip.url:http://114.135.61.186:21020/productionmanage/warnDetail}")
+    @Value("${message.water.source.skip.url:/productionmanage/warnDetail}")
     private String waterSourceSkipUrl;
 
     /**
      * 水厂告警消息跳转链接
      */
-    @Value("${message.water.works.skip.url:http://114.135.61.186:21020/productionmanage/warnDetail}")
+    @Value("${message.water.works.skip.url:/productionmanage/warnDetail}")
     private String waterWorksSkipUrl;
 
     /**
      * 泵站告警消息跳转链接
      */
-    @Value("${message.pumping.station.skip.url:http://114.135.61.186:21020/secondwatersupply/warnDetail}")
+    @Value("${message.pumping.station.skip.url:/secondwatersupply/warnDetail}")
     private String pumpingStationSkipUrl;
 
     /**
      * 管网告警消息跳转链接
      */
-    @Value("${message.pipe.network.skip.url:http://114.135.61.186:21020/gwmangement/warnDetail}")
+    @Value("${message.pipe.network.skip.url:/gwmangement/warnDetail}")
     private String pipeNetworkSkipUrl;
 
     /**

+ 2 - 2
zoniot-water/zoniot-water-web/src/main/java/com/bz/zoneiot/water/web/service/impl/AlarmTypeDetailsServiceImpl.java

@@ -190,8 +190,8 @@ public class AlarmTypeDetailsServiceImpl implements AlarmTypeDetailsService {
             alarmDetailsEntity.setParentSceneName(sceneVo.getParentSceneName());
 
             alarmDetailsEntity.setAlarmValue(value.doubleValue());
-            alarmDetailsEntity.setCompanyOrgId(alarmType.getCompanyOrgId());
-            alarmDetailsEntity.setDeptOrgId(alarmType.getDeptOrgId());
+            alarmDetailsEntity.setCompanyOrgId(sceneVo.getCompanyOrgId());
+            alarmDetailsEntity.setDeptOrgId(sceneVo.getDeptOrgId());
             alarmDetailsEntity.setTenantId(alarmType.getTenantId());
             alarmDetailsEntity.setAlarmId(Long.parseLong(alarmType.getId().toString()));
             alarmDetailsEntity.setAlarmType(alarmType.getAlarmCategory() == 1 ? "参数报警" : "状态报警");

+ 74 - 0
zoniot-water/zoniot-water-xxl-client/src/main/java/com/bz/zoneiot/water/xxl/config/XxlJobConfig.java

@@ -0,0 +1,74 @@
+package com.bz.zoneiot.water.xxl.config;
+
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * xxl-job config
+ * @author Andy
+ */
+@Configuration
+public class XxlJobConfig {
+
+    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
+
+    @Value("${xxl.job.admin.addresses}")
+    private String adminAddresses;
+
+    @Value("${xxl.job.executor.appname}")
+    private String appName;
+
+    @Value("${xxl.job.executor.ip}")
+    private String ip;
+
+    @Value("${xxl.job.executor.port}")
+    private int port;
+
+    @Value("${xxl.job.accessToken}")
+    private String accessToken;
+
+    @Value("${xxl.job.executor.logpath}")
+    private String logPath;
+
+    @Value("${xxl.job.executor.logretentiondays}")
+    private int logRetentionDays;
+
+
+    @Bean
+    public XxlJobSpringExecutor xxlJobExecutor() {
+        logger.info(">>>>>>>>>>> xxl-job config init. {}:{}", adminAddresses, port);
+        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+        xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
+        xxlJobSpringExecutor.setAppname(appName);
+        xxlJobSpringExecutor.setIp(ip);
+        xxlJobSpringExecutor.setPort(port);
+        xxlJobSpringExecutor.setAccessToken(accessToken);
+        xxlJobSpringExecutor.setLogPath(logPath);
+        xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
+
+        return xxlJobSpringExecutor;
+    }
+
+    /**
+     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
+     *
+     *      1、引入依赖:
+     *          <dependency>
+     *             <groupId>org.springframework.cloud</groupId>
+     *             <artifactId>spring-cloud-commons</artifactId>
+     *             <version>${version}</version>
+     *         </dependency>
+     *
+     *      2、配置文件,或者容器启动变量
+     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+     *
+     *      3、获取IP
+     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+     */
+
+
+}

+ 4 - 1
zoniot-water/zoniot-water-xxl-client/src/main/java/com/bz/zoneiot/water/xxl/service/AbstractDataAlarmJobService.java

@@ -65,9 +65,10 @@ public abstract class AbstractDataAlarmJobService {
     public void execute(){
         List<DataAlarmManageVo> manageVoList = this.listDataAlarmManage();
         if (CollectionUtils.isEmpty(manageVoList)) {
-            log.info("获取数据报警管理参数数据为空");
+            log.info("【数据报警】获取数据报警管理参数数据为空");
             return;
         }
+        log.info("【数据报警】获取数据报警管理参数数据条数:{}", manageVoList.size());
         DataAlarmManageEntity manageEntity;
         DataAlarmDetailEntity nowDetailEntity;
         Map<Long, DataAlarmDetailEntity> alarmDetailsDtoMap = getMapDataAlarmDetail(manageVoList);
@@ -76,10 +77,12 @@ public abstract class AbstractDataAlarmJobService {
             BeanUtils.copyProperties(manageVo, manageEntity);
             nowDetailEntity = this.getAlarmValue(manageEntity);
             if (nowDetailEntity == null) {
+                log.info("【数据报警】获取[{}]数据报警值为空,进行过滤。",manageEntity.getAlarmName());
                 continue;
             }
             nowDetailEntity.setManageId(manageEntity.getId());
             boolean isAlarm = isAlarm(nowDetailEntity, manageEntity);
+            log.info("【数据报警】获取[{}]数据报警值为空,是否触发报警[{}]",manageEntity.getAlarmName(), isAlarm);
             // 必须先计算报警数据,才能执行保存数据报警分析操作,不然会丢失数据
             this.saveDataAlarmAnalysis(nowDetailEntity);
             // 计算出来属于报警,处理报警数据

+ 2 - 2
zoniot-water/zoniot-water-xxl-client/src/main/resources/bootstrap-dev.yml

@@ -1,6 +1,6 @@
 spring:
   application:
-    name: zoniot-water-xxljob-client
+    name: zoniot-water-xxl-client
   profiles:
     active: dev
   cloud:
@@ -8,7 +8,7 @@ spring:
       config:
         namespace: 73da6876-408b-4850-9ef9-cd2c4ea831bf
         server-addr: 127.0.0.1:8848
-        prefix: zoniot-water-xxljob-client
+        prefix: zoniot-water-xxl-client
         file-extension: properties
   main:
     allow-bean-definition-overriding: true

+ 2 - 2
zoniot-water/zoniot-water-xxl-client/src/main/resources/bootstrap-sit.yml

@@ -1,6 +1,6 @@
 spring:
   application:
-    name: zoniot-water-xxljob-client
+    name: zoniot-water-xxl-client
   profiles:
     active: sit
   cloud:
@@ -8,7 +8,7 @@ spring:
       config:
         namespace: 33c2968d-5b0c-4da2-bfd7-af8ef5a8f669
         server-addr: 10.0.0.63:8848
-        prefix: zoniot-water-xxljob-client
+        prefix: zoniot-water-xxl-client
         file-extension: properties
   main:
     allow-bean-definition-overriding: true