From 71ffca01f72540bcabc792c22c3daa74ce2eddc8 Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期四, 13 二月 2025 17:51:17 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunLDGTankFactorPredTask.java     |   65 ++++++++++++++++++++++++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignConfig.java                    |   22 +++++++++++
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java         |    3 -
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleOnaOptTask.java        |    8 ++--
 shasteel-biz/src/main/java/com/iailab/module/shasteel/framework/rpc/config/RpcConfiguration.java |    3 +
 shasteel-biz/pom.xml                                                                             |   10 ++--
 shasteel-biz/src/main/resources/application.yaml                                                 |    2 +
 shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java   |    2 
 8 files changed, 102 insertions(+), 13 deletions(-)

diff --git a/shasteel-biz/pom.xml b/shasteel-biz/pom.xml
index 4839e82..ad032ed 100644
--- a/shasteel-biz/pom.xml
+++ b/shasteel-biz/pom.xml
@@ -34,6 +34,11 @@
             <artifactId>iailab-module-model-api</artifactId>
             <version>${revision}</version>
         </dependency>
+        <dependency>
+            <groupId>com.iailab</groupId>
+            <artifactId>iailab-module-data-api</artifactId>
+            <version>${revision}</version>
+        </dependency>
 
         <!-- 业务组件 -->
         <dependency>
@@ -131,11 +136,6 @@
         <dependency>
             <groupId>com.iailab</groupId>
             <artifactId>iailab-common-mq</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.iailab</groupId>
-            <artifactId>iailab-module-model-api</artifactId>
         </dependency>
 
     </dependencies>
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignConfig.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignConfig.java
new file mode 100644
index 0000000..e85cd2d
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignConfig.java
@@ -0,0 +1,22 @@
+package com.iailab.module.shasteel.config;
+
+import feign.Logger;
+import feign.Request;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.concurrent.TimeUnit;
+
+@Configuration
+public class FeignConfig {
+
+    @Bean
+    Logger.Level feignLoggerLevel() {
+        return Logger.Level.FULL;
+    }
+
+    @Bean
+    Request.Options options() {
+        return new Request.Options(10, TimeUnit.SECONDS,3,TimeUnit.MINUTES,true); // 连接超时10秒,读取超时3分钟
+    }
+}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/framework/rpc/config/RpcConfiguration.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/framework/rpc/config/RpcConfiguration.java
index bed8227..9a797c3 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/framework/rpc/config/RpcConfiguration.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/framework/rpc/config/RpcConfiguration.java
@@ -1,5 +1,6 @@
 package com.iailab.module.shasteel.framework.rpc.config;
 
+import com.iailab.module.data.api.point.DataPointApi;
 import com.iailab.module.infra.api.config.ConfigApi;
 import com.iailab.module.infra.api.db.DataSourceConfigServiceApi;
 import com.iailab.module.infra.api.file.FileApi;
@@ -11,6 +12,6 @@
 import org.springframework.context.annotation.Configuration;
 
 @Configuration(proxyBeanMethods = false)
-@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, DataSourceConfigServiceApi.class, ConfigApi.class, TenantApi.class, McsApi.class, MdkApi.class})
+@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, DataSourceConfigServiceApi.class, ConfigApi.class, TenantApi.class, McsApi.class, MdkApi.class, DataPointApi.class})
 public class RpcConfiguration {
 }
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunLDGTankFactorPredTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunLDGTankFactorPredTask.java
new file mode 100644
index 0000000..f7fec37
--- /dev/null
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunLDGTankFactorPredTask.java
@@ -0,0 +1,65 @@
+package com.iailab.module.shasteel.job.task;
+
+import com.iailab.module.data.api.point.DataPointApi;
+import com.iailab.module.model.api.mdk.MdkApi;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+
+/**
+ * @description: LDG柜容预测 监听触发
+ *  points(当前时刻大于0,上一时刻为0)则触发
+ * @author: dzd
+ * @date: 2025/2/13 16:22
+ **/
+@Component("runLDGTankFactorPredTask")
+public class RunLDGTankFactorPredTask implements ITask {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+    @Autowired
+    private DataPointApi dataPointApi;
+    @Autowired
+    private RunPredictModuleTask runPredictModuleTask;
+
+    /**
+     * map<NetCode,[pointNos]>
+     **/
+    private static final HashMap<String, List<String>> checkPoints = new HashMap<String, List<String>>(){{
+        put("NET_LDG1", Arrays.asList("M0000100050","M0000100049","M0000100048"));
+        put("NET_LDG2", Arrays.asList("M0000100062","M0000100061","M0000100060"));
+        put("NET_LDG3", Arrays.asList("M0000100057","M0000100056","M0000100055"));
+    }};
+
+    private static HashMap<String,Double> pointsLastValue = new HashMap<>();
+
+    @Override
+    public void run(String params) {
+        logger.info("runLDGTankFactorPredTask定时任务正在执行,参数为:{}", params);
+        try {
+            for (Map.Entry<String, List<String>> entry : checkPoints.entrySet()) {
+                Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(entry.getValue());
+                for (Map.Entry<String, Object> pointRealValue : pointsRealValue.entrySet()) {
+                    String pointNo = pointRealValue.getKey();
+                    Double value = null == pointRealValue.getValue() ? null : Double.valueOf(pointRealValue.getValue().toString());
+                    //如果有旧值,且旧值为0,且新值不为null,且新值>0  触发模型
+                    if (null != pointsLastValue.get(pointNo) && pointsLastValue.get(pointNo).equals(0.0) && null != value && value.compareTo(0.0) > 0){
+                        runPredictModuleTask.run(entry.getKey());
+                        break;
+                    }
+                }
+
+                for (Map.Entry<String, Object> pointRealValue : pointsRealValue.entrySet()) {
+                    Double value = null == pointRealValue.getValue() ? null : Double.valueOf(pointRealValue.getValue().toString());
+                    pointsLastValue.put(pointRealValue.getKey(),value);
+                }
+
+            }
+        } catch (Exception ex) {
+            logger.error("runLDGTankFactorPredTask运行异常",ex);
+        }
+        logger.info("runLDGTankFactorPredTask运行完成");
+    }
+}
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java
index 1da83d1..02cbe8f 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java
@@ -66,8 +66,7 @@
                 }
             });
         } catch (Exception ex) {
-            logger.error("runPredictModuleTask运行异常");
-            ex.printStackTrace();
+            logger.error("runPredictModuleTask运行异常",ex);
         }
         logger.info("runPredictModuleTask运行完成");
     }
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java
index 74a9c66..ca7f863 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleAirDispatchTask.java
@@ -90,7 +90,7 @@
                     StringUtils.isNotEmpty(mdkScheduleRespDTO.getResult().get("pressureHWarning").toString())) {
                 String pressureHWarning = mdkScheduleRespDTO.getResult().get("pressureHWarning").toString();
                 AlarmMessageRespDTO alarm = new AlarmMessageRespDTO();
-                alarm.setTitle("压力高于上限预警");
+                alarm.setTitle("空压机预警");
                 alarm.setContent(pressureHWarning);
                 alarm.setAlarmObj(scheme.getScheduleObj());
                 alarm.setAlarmType("高于上限");
diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleOnaOptTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleOnaOptTask.java
index b9a5bf3..4a5fad6 100644
--- a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleOnaOptTask.java
+++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleOnaOptTask.java
@@ -111,16 +111,16 @@
                     String runAdvice = entry.getValue().getResult().get("runAdvice").toString();
                     String yingdiAdvice = entry.getValue().getResult().get("yingdiAdvice").toString();
                     if(!yingdiAdvice.equals("压力正常")){
-                        saveScheduleSuggest("盈德中压建议调整量", yingdiAdvice, scheduleObj, scheduleTime);
+                        saveScheduleSuggest("盈德中压调整建议", yingdiAdvice, scheduleObj, scheduleTime);
                     }
                     if(!faAdvice.equals("压力正常")){
-                        saveScheduleSuggest("法夜空建议调整量", faAdvice, scheduleObj, scheduleTime);
+                        saveScheduleSuggest("法夜空调整建议", faAdvice, scheduleObj, scheduleTime);
                     }
                     if(!hongAdvice.equals("压力正常")){
-                        saveScheduleSuggest("宏昌建议调整量", hongAdvice, scheduleObj, scheduleTime);
+                        saveScheduleSuggest("宏昌调整建议", hongAdvice, scheduleObj, scheduleTime);
                     }
                     if(!runAdvice.equals("压力正常")){
-                        saveScheduleSuggest("润忠建议调整量", runAdvice, scheduleObj, scheduleTime);
+                        saveScheduleSuggest("润忠调整建议", runAdvice, scheduleObj, scheduleTime);
                     }
                 } else if (entry.getKey().equals(CODE01)) {
                     String scheduleObj = schemeMap.get(CODE01).getScheduleObj();
diff --git a/shasteel-biz/src/main/resources/application.yaml b/shasteel-biz/src/main/resources/application.yaml
index a58b237..4927276 100644
--- a/shasteel-biz/src/main/resources/application.yaml
+++ b/shasteel-biz/src/main/resources/application.yaml
@@ -64,6 +64,8 @@
     com.iailab.module.fast.dal.mysql: debug
     com.iailab.module.fast.dal.mysql.sensitiveword.SensitiveWordMapper: INFO # 配置 SensitiveWordMapper 的日志级别为 info
     com.iailab.module.fast.dal.mysql.sms.SmsChannelMapper: INFO # 配置 SmsChannelMapper 的日志级别为 info
+    # feign接口日志等级
+    com.iailab.module.model.api.mcs: debug
 
 --- #################### 接口文档配置 ####################
 

--
Gitblit v1.9.3