Ver código fonte

代码优化

wangxiaofei 2 semanas atrás
pai
commit
bd524bafdc

+ 4 - 1
taphole-iron/src/main/java/com/sckj/iron/entity/TIronData.java

@@ -91,5 +91,8 @@ public class TIronData implements Serializable {
     @ApiModelProperty(value = "结束时间")
     private String ironEndtime;
 
-
+    @ApiModelProperty(value = "估计出铁时间")
+    @ExcelProperty("估计出铁时间")
+    @ColumnWidth(25)
+    private Integer ironCalctime;
 }

+ 8 - 5
taphole-iron/src/main/java/com/sckj/iron/service/impl/TIronTestServiceImpl.java

@@ -265,10 +265,10 @@ public class TIronTestServiceImpl extends ServiceImpl<TIronTestMapper, TIronTest
                                     ironWeight = (double) ironTestItem.getValue();
                                     break;
                                 case "出铁时间":
-                                    ironCosttime = (int) ironTestItem.getValue();
+                                    ironCosttime = ((Number) ironTestItem.getValue()).intValue();
                                     break;
                                 case "铁水平均流速":
-                                    avgSpeed = new BigDecimal(String.valueOf(ironTestItem.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue();
+                                  //  avgSpeed = new BigDecimal(String.valueOf(ironTestItem.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue();
                                     break;
                                 case "铁水平均温度":
                                     avgTemp = (double) ironTestItem.getValue();
@@ -278,8 +278,12 @@ public class TIronTestServiceImpl extends ServiceImpl<TIronTestMapper, TIronTest
                                     break;
                             }
                         }
+                        if(ironCosttime > 0){
+                            avgSpeed = BigDecimal.valueOf(ironWeight).divide(BigDecimal.valueOf(ironCosttime),2, RoundingMode.HALF_UP).doubleValue();
+                        }else{
+                            ironCosttime = 0;
+                        }
                         //按照主键每个更新
-
                         TIronTest updateInfo = runnableTappingTest(mIronParams, ironCosttime, ironWeight, avgSpeed, avgTemp, null,null);
                         updateInfo.setId(ironTest.getId());
                         boolean saveResult = updateById(updateInfo);
@@ -304,7 +308,7 @@ public class TIronTestServiceImpl extends ServiceImpl<TIronTestMapper, TIronTest
                     double ironWeight = tl2Data.getCalcWeight();
                     int ironCosttime = tl2Data.getIronCosttime();
                     double avgTemp = tl2Data.getAvgTemp();
-                    double avgSpeed = BigDecimal.valueOf(ironWeight).divide(BigDecimal.valueOf(ironCosttime), 2, BigDecimal.ROUND_HALF_UP).doubleValue();
+                    double avgSpeed = BigDecimal.valueOf(ironWeight).divide(BigDecimal.valueOf(ironCosttime), 2, RoundingMode.HALF_UP).doubleValue();
                     TIronTest ironTest = runnableTappingTest(mIronParams, ironCosttime, ironWeight, avgSpeed, avgTemp, tl2Data.getIronNo(),tl2Data.getCreateTime());
                     boolean saveResult = save(ironTest);
                     log.info("💾 诊断结果保存{} - 记录ID: {}", saveResult ? "成功" : "失败", ironTest.getId());
@@ -323,7 +327,6 @@ public class TIronTestServiceImpl extends ServiceImpl<TIronTestMapper, TIronTest
             String standardIronTime = mIronParams.get(ParamsConstants.iron_time);
             String standardTemp = mIronParams.get(ParamsConstants.ironwater_temp);
             String standardIronWeight = mIronParams.get(ParamsConstants.iron_weight);
-            Integer standardOpenHour = Integer.parseInt(ParamsConstants.open_hour);
             double stdIronSpeedMin = Double.parseDouble(standardSpeed.split("-")[0]);
             double stdIronSpeedMax = Double.parseDouble(standardSpeed.split("-")[1]);
             int stdIronTimeMin = Integer.parseInt(standardIronTime.split("-")[0]);

+ 24 - 18
taphole-iron/src/main/java/com/sckj/iron/service/impl/TIronVisualScreenServiceImpl.java

@@ -14,6 +14,8 @@ import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
@@ -633,7 +635,7 @@ public class TIronVisualScreenServiceImpl {
         Map<String, Double> weight1Map = new LinkedHashMap<>();
         for (IronTrendL1DTO e : weight1List) {
             if (e.getCreateTime() != null) {
-                String min = sdfMinute.format(e.getCreateTime());
+                String minute = sdfMinute.format(e.getCreateTime());
                 Object v = e.getData();
                 Double value = null;
                 if (v instanceof Number) value = ((Number) v).doubleValue();
@@ -647,14 +649,14 @@ public class TIronVisualScreenServiceImpl {
                     }
                 }
                 if (value != null) {
-                    weight1Map.put(min, value);
+                    weight1Map.put(minute, value);
                 }
             }
         }
         Map<String, Double> weight2Map = new LinkedHashMap<>();
         for (IronTrendL1DTO e : weight2List) {
             if (e.getCreateTime() != null) {
-                String min = sdfMinute.format(e.getCreateTime());
+                String minute = sdfMinute.format(e.getCreateTime());
                 Object v = e.getData();
                 Double value = null;
                 if (v instanceof Number) value = ((Number) v).doubleValue();
@@ -668,15 +670,17 @@ public class TIronVisualScreenServiceImpl {
                     }
                 }
                 if (value != null) {
-                    weight2Map.put(min, value);
+                    weight2Map.put(minute, value);
                 }
             }
         }
         // 合并weight1Map和weight2Map到weightMap,取最大值
         Map<String, Double> weightMap = new LinkedHashMap<>();
+        //先将weight1Map复制到weightMap中
         for (Map.Entry<String, Double> entry : weight1Map.entrySet()) {
             weightMap.put(entry.getKey(), entry.getValue());
         }
+        //然后将weight2Map复制到weightMap中,重复的取最大值
         for (Map.Entry<String, Double> entry : weight2Map.entrySet()) {
             weightMap.put(entry.getKey(), Math.max(weightMap.getOrDefault(entry.getKey(), 0d), entry.getValue()));
         }
@@ -686,39 +690,41 @@ public class TIronVisualScreenServiceImpl {
                 .collect(java.util.LinkedHashMap::new, (m, e) -> m.put(e.getKey(), e.getValue()), java.util.LinkedHashMap::putAll);
         List<List<Object>> arr = new ArrayList<>();
         boolean inTappingCycle = false;
-        java.math.BigDecimal cycleTotal = java.math.BigDecimal.ZERO;
-        java.math.BigDecimal lastW = java.math.BigDecimal.ZERO;
+        //
+        BigDecimal cycleTotal = BigDecimal.ZERO;
+        //
+        BigDecimal lastValue = BigDecimal.ZERO;
         for (int i = 0; i < xAxis.size(); i++) {
             String time = xAxis.get(i);
             Integer tapping = tappingMap.getOrDefault(time, 0);
-            java.math.BigDecimal w = new java.math.BigDecimal(weightMap.getOrDefault(time, 0d).toString());
+            BigDecimal bigDecimal = new BigDecimal(weightMap.getOrDefault(time, 0d).toString());
             if (tapping == 1) {
                 if (!inTappingCycle) {
                     inTappingCycle = true;
                     //System.out.println("[出铁周期结束] 开始于: " + time);
                 }
-                if (w.compareTo(java.math.BigDecimal.ZERO) == 0) {
-                    w = lastW;
-                    weightMap.put(time, w.doubleValue());
+                if (bigDecimal.compareTo(BigDecimal.ZERO) == 0) {
+                    bigDecimal = lastValue;
+                    weightMap.put(time, bigDecimal.doubleValue());
                 } else {
-                    lastW = w;
+                    lastValue = bigDecimal;
                 }
                 if (i > 0) {
-                    java.math.BigDecimal prevW = new java.math.BigDecimal(weightMap.getOrDefault(xAxis.get(i - 1), 0d).toString());
+                    BigDecimal prevW = new BigDecimal(weightMap.getOrDefault(xAxis.get(i - 1), 0d).toString());
                     //上一个减去当前的
-                    if (prevW.subtract(w).compareTo(new java.math.BigDecimal("130")) > 0) {
-                        //System.out.println("[出铁周期满载情况] 时间: " + xAxis.get(i - 1) + ", 铁水满载值: " + prevW);
+                    if (prevW.subtract(bigDecimal).compareTo(new BigDecimal("130")) > 0) {
+                        System.out.println("[出铁周期满载情况] 时间: " + xAxis.get(i - 1) + ", 铁水满载值: " + prevW);
                         cycleTotal = cycleTotal.add(prevW);
                     }
                 }
-                arr.add(java.util.Arrays.asList(time, w.add(cycleTotal).setScale(scale, java.math.RoundingMode.HALF_UP).doubleValue()));
+                arr.add(java.util.Arrays.asList(time, bigDecimal.add(cycleTotal).setScale(scale, RoundingMode.HALF_UP).doubleValue()));
             } else {
                 if (inTappingCycle) {
-                    double value = cycleTotal.setScale(scale, java.math.RoundingMode.HALF_UP).doubleValue();
-                    //System.out.println("[出铁周期结束] 结束于: " + time + ", 本周期铁水总净重: " + value);
+                    double value = cycleTotal.setScale(scale, RoundingMode.HALF_UP).doubleValue();
+                    System.out.println("[出铁周期结束] 结束于: " + time + ", 本周期铁水总净重: " + value);
                     arr.add(java.util.Arrays.asList(time, value));
                     inTappingCycle = false;
-                    cycleTotal = java.math.BigDecimal.ZERO;
+                    cycleTotal = BigDecimal.ZERO;
 //                    for (List<Object> objects : arr) {
 //                        System.out.println(objects.get(0)+" >>> "+objects.get(1));
 //                    }

+ 100 - 40
taphole-iron/src/main/java/com/sckj/iron/socketio/DeviceEventListener.java

@@ -31,6 +31,7 @@ import com.sckj.opc.dataservice.OPCDAServiceImpl;
 import com.sckj.opc.entity.OPCData;
 import com.sckj.opc.service.OPCDataServiceImpl;
 import com.sckj.opc.service.THdTagServiceImpl;
+import com.sckj.warn.dto.TAudioDTO;
 import com.sckj.warn.entity.TAudio;
 import com.sckj.warn.entity.TExceptionLog;
 import com.sckj.warn.service.impl.TAudioServiceImpl;
@@ -250,7 +251,7 @@ public class DeviceEventListener extends AbstractEventListener { //
     private Map<String, TIronModel> modelMap = new ConcurrentHashMap<>();
 
     // 音频统一管理
-    private Map<String, String> audioMap = new ConcurrentHashMap<>();
+    private Map<String, TAudioDTO> audioMap = new ConcurrentHashMap<>();
 
     //建议打泥量
     private String mCalcHitMud;
@@ -336,9 +337,14 @@ public class DeviceEventListener extends AbstractEventListener { //
      * 预警音频
      */
     private void getAudios() {
-        audioMap = audioService.lambdaQuery().eq(TAudio::getStatus, "1").eq(TAudio::getDelFlag, "1").list().stream().collect(Collectors.toMap(
+        audioMap = audioService.lambdaQuery().eq(TAudio::getDelFlag, "1").list().stream().collect(Collectors.toMap(
                 TAudio::getExceptionType, // 键映射函数
-                audio -> SERVER_URL + "/" + GlobalConfig.publicPrefix + File.separator + audio.getPath(), // 值映射函数
+                audio -> {
+                    TAudioDTO tAudioDTO = new TAudioDTO();
+                    BeanUtils.copyProperties(audio, tAudioDTO);
+                    tAudioDTO.setAlarmUrl(SERVER_URL + "/" + GlobalConfig.publicPrefix + File.separator + audio.getPath());
+                    return tAudioDTO;
+                }, // 值映射函数
                 (existing, replacement) -> existing // 合并函数
         ));
     }
@@ -798,15 +804,19 @@ public class DeviceEventListener extends AbstractEventListener { //
     private void getCloseTime() {
         log.info("开始计算预计剩余出铁时间");
 
+        RealtimeData realtimeData = new RealtimeData();
+        realtimeData.setDesc("距离堵口预计还剩");
+        realtimeData.setUnit("分钟");
+        int diffCloseTime = 0;
+
         if (ironLoading1.get() <= 0) {
             log.info("当前铁口状态: 非出铁状态, 跳过计算");
+            realtimeData.setValue(diffCloseTime);
+            PushData.send2CloseTime(realtimeData);
+            log.info("推送剩余出铁时间数据完成, 剩余时间: {}分钟", diffCloseTime);
             return;
         }
 
-        RealtimeData realtimeData = new RealtimeData();
-        realtimeData.setDesc("距离堵口预计还剩");
-        realtimeData.setUnit("分钟");
-        int diffCloseTime = 0;
 
         //实时出铁时间
         int ironElapsedMinute = getIronElapsedMinute();
@@ -848,6 +858,13 @@ public class DeviceEventListener extends AbstractEventListener { //
         PushData.send2CloseTime(realtimeData);
         log.info("推送剩余出铁时间数据完成");
 
+        if(ObjectUtils.isNotEmpty(mTIronData) && ObjectUtils.isNotEmpty(mTIronData.getId()) ) {
+            //ironCalctime
+            mTIronData.setIronCalctime(diffCloseTime);
+            boolean saveResult = ironDataService.saveOrUpdate(mTIronData);
+            log.info("出铁数据更新{} - 影响记录数: {}", saveResult ? "成功" : "失败", saveResult ? 1 : 0);
+        }
+
         //堵口前30分钟左右,计算打泥量
         if (diffCloseTime <= 30 && !isClosureTime.get()) {
             //表示已经计算过打泥量了
@@ -1112,8 +1129,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                 log.warn("⚠️ 出铁时间过短: 实际{}分钟 < 标准{}分钟", actualTime, stdIronTimeMin);
                 taskExecutor.submit(() -> {
                     log.info("📝 记录出铁时间过短异常...");
-                    PushData.send2Warn(WarnData.warnTapping("出铁时间过短",
-                            audioMap.get(ExceptionTypeEnum.IRON_TIME_SHORT.getCode())));
+                    PushData.send2Warn(audioMap.get(ExceptionTypeEnum.IRON_TIME_SHORT.getCode()));
                     saveException(ExceptionTypeEnum.IRON_TIME_SHORT,
                             String.format("出铁时间%s分钟", actualTime));
                     getExceptionList();
@@ -1132,8 +1148,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                 log.warn("⚠️ 出铁量过少: 实际{}吨 < 标准{}吨", actualWeight, stdIronWeightMin);
                 taskExecutor.submit(() -> {
                     log.info("📝 记录出铁量过少异常...");
-                    PushData.send2Warn(WarnData.warnTapping("出铁量过少",
-                            audioMap.get(ExceptionTypeEnum.IRON_WEIGHT_FEW.getCode())));
+                    PushData.send2Warn(audioMap.get(ExceptionTypeEnum.IRON_WEIGHT_FEW.getCode()));
                     saveException(ExceptionTypeEnum.IRON_WEIGHT_FEW,
                             String.format("出铁量%s吨", actualWeight));
                     getExceptionList();
@@ -1208,7 +1223,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                             log.warn("模型1触发堵口告警1");
 
                             taskExecutor.submit(() -> {
-                                PushData.send2Warn(WarnData.warnClose("堵口告警1", audioMap.get(ExceptionTypeEnum.CLOSURE1.getCode())));
+                                PushData.send2Warn(audioMap.get(ExceptionTypeEnum.CLOSURE1.getCode()));
                                 saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("流速过大,建议将当前铁口堵口"));
                                 //推送预警列表
                                 getExceptionList();
@@ -1237,7 +1252,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                             log.warn("模型1触发堵口告警2");
 
                             taskExecutor.submit(() -> {
-                                PushData.send2Warn(WarnData.warnClose("堵口告警2", audioMap.get(ExceptionTypeEnum.CLOSURE2.getCode())));
+                                PushData.send2Warn( audioMap.get(ExceptionTypeEnum.CLOSURE2.getCode()));
                                 saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("流速过小,但其它铁口正在出铁,请将当前铁口堵口"));
                                 //推送预警列表
                                 getExceptionList();
@@ -1266,7 +1281,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                         if (count >= triggerCount3) {
                             log.warn("模型3触发堵口告警3");
                             taskExecutor.submit(() -> {
-                                PushData.send2Warn(WarnData.warnClose("堵口告警3", audioMap.get(ExceptionTypeEnum.CLOSURE3.getCode())));
+                                PushData.send2Warn(audioMap.get(ExceptionTypeEnum.CLOSURE3.getCode()));
                                 saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("流速过小且其他铁口均未出铁,请先将其它铁口打开,再进行堵口"));
                                 //推送预警列表
                                 getExceptionList();
@@ -1325,7 +1340,7 @@ public class DeviceEventListener extends AbstractEventListener { //
 
                         try {
                             try {
-                                PushData.send2Warn(WarnData.warnTapping("出铁超时", audioMap.get(ExceptionTypeEnum.IRON_TIME_LONG.getCode())));
+                                PushData.send2Warn(audioMap.get(ExceptionTypeEnum.IRON_TIME_LONG.getCode()));
                                 // 记录异常信息
                                 String exceptionMessage = String.format("出铁时间:%s分钟", currentIronTime);
                                 saveException(ExceptionTypeEnum.IRON_TIME_LONG, exceptionMessage);
@@ -1377,7 +1392,7 @@ public class DeviceEventListener extends AbstractEventListener { //
 
                     taskExecutor.submit(() -> {
                         try {
-                            PushData.send2Warn(WarnData.warnTapping("出铁量过多", audioMap.get(ExceptionTypeEnum.IRON_WEIGHT_MANY.getCode())));
+                            PushData.send2Warn(audioMap.get(ExceptionTypeEnum.IRON_WEIGHT_MANY.getCode()));
                             saveException(ExceptionTypeEnum.IRON_WEIGHT_MANY, String.format("出铁量%s吨", mTotalWeight));
                             //推送预警列表
                             getExceptionList();
@@ -1540,6 +1555,13 @@ public class DeviceEventListener extends AbstractEventListener { //
 
                 log.info("打泥量计算完成: {} L", mCalcHitMud);
 
+                if(ObjectUtils.isNotEmpty(mTIronData) && ObjectUtils.isNotEmpty(mTIronData.getId()) ) {
+                    //ironCalctime
+                    mTIronData.setMudWeight(mCalcHitMud);
+                    boolean saveResult = ironDataService.saveOrUpdate(mTIronData);
+                    log.info("出铁数据更新打泥量{} - 影响记录数: {}", saveResult ? "成功" : "失败", saveResult ? 1 : 0);
+                }
+
                 // 推送结果
                 PushData.send2IronHitMud(mCalcHitMud);
                 log.info("打泥量结果已推送至前端: {} L", mCalcHitMud);
@@ -1598,7 +1620,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                             log.warn("触发急需出铁告警,压差超过阈值: {}", mContext.lookupVariable(ExpressionConstants.stdPressureDiff));
 
                             //触发次数超过配置的次数后发出预警
-                            PushData.send2Warn(WarnData.warnTapping("急需出铁告警", audioMap.get(ExceptionTypeEnum.NEED_TAPHOLE.getCode())));
+                            PushData.send2Warn(audioMap.get(ExceptionTypeEnum.NEED_TAPHOLE.getCode()));
                             saveException(ExceptionTypeEnum.NEED_TAPHOLE,
                                     String.format("压差超过%skPa,请降低送风流量,并操作出铁",
                                             String.valueOf(mContext.lookupVariable(ExpressionConstants.stdPressureDiff))));
@@ -1908,11 +1930,15 @@ public class DeviceEventListener extends AbstractEventListener { //
                                     mTIronData = new TIronData();
                                     mTIronData.setId(tappingInfo.getIronDataId());
 
-                                    LocalDateTime now = LocalDateTime.now();
+
                                     long currentTimeMillis = System.currentTimeMillis();
                                     long diffInSeconds = (currentTimeMillis - tappingInfo.getSourceTime().getTime()) / 1000;
                                     //长整数到整数的转换,防止溢出
-                                    mSecondsElapsed.addAndGet(Math.toIntExact(diffInSeconds));
+                                    int alreadyIronMin = Math.toIntExact(diffInSeconds);
+                                    mSecondsElapsed.addAndGet(alreadyIronMin);
+
+                                    log.info("   ├─  已经出铁时间(分钟): " + alreadyIronMin);
+
 
                                     try {
                                         mTotalCloseTime = (int) RedisUtils.getFixedLatestElement(RedisConstants.TOTAL_CLOSE_TIME);
@@ -2107,7 +2133,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                         taskExecutor.submit(() -> {
                             try {
                                 String exceptionMsg = String.format("温度%s℃", tempNow);
-                                PushData.send2Warn(WarnData.warnTapping("铁水温度过低", audioMap.get(ExceptionTypeEnum.IRON_TEMP_HIGH.getCode())));
+                                PushData.send2Warn( audioMap.get(ExceptionTypeEnum.IRON_TEMP_HIGH.getCode()));
                                 saveException(ExceptionTypeEnum.IRON_TEMP_HIGH, exceptionMsg);
                                 log.warn("已记录温度过低异常: {}", exceptionMsg);
 
@@ -2134,7 +2160,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                         taskExecutor.submit(() -> {
                             try {
                                 String exceptionMsg = String.format("温度%s℃", tempNow);
-                                PushData.send2Warn(WarnData.warnTapping("铁水温度过高", audioMap.get(ExceptionTypeEnum.IRON_TEMP_LOW.getCode())));
+                                PushData.send2Warn(audioMap.get(ExceptionTypeEnum.IRON_TEMP_LOW.getCode()));
                                 saveException(ExceptionTypeEnum.IRON_TEMP_LOW, exceptionMsg);
                                 log.warn("已记录温度过高异常: {}", exceptionMsg);
 
@@ -2205,7 +2231,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                         log.info("流速过低计数: {}/3", count);
 
                         if (count >= StandardConstans.WARN_COUNT) {
-                            PushData.send2Warn(WarnData.warnTapping("铁水流速过慢", audioMap.get(ExceptionTypeEnum.IRON_SPEED_SLOW.getCode())));
+                            PushData.send2Warn(audioMap.get(ExceptionTypeEnum.IRON_SPEED_SLOW.getCode()));
                             log.error("触发流速过低预警");
                             saveException(ExceptionTypeEnum.IRON_SPEED_SLOW, String.format("流速%s吨/分钟", mMaxSpeed.get()));
                             //推送预警列表
@@ -2221,7 +2247,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                         log.info("流速过高计数: {}/3", count);
                         if (count >= StandardConstans.WARN_COUNT) {
                             log.error("触发流速过高预警");
-                            PushData.send2Warn(WarnData.warnTapping("铁水流速过快", audioMap.get(ExceptionTypeEnum.IRON_SPEED_FAST.getCode())));
+                            PushData.send2Warn(audioMap.get(ExceptionTypeEnum.IRON_SPEED_FAST.getCode()));
                             saveException(ExceptionTypeEnum.IRON_SPEED_FAST, String.format("流速%s吨/分钟", mMaxSpeed.get()));
                             //推送预警列表
                             getExceptionList();
@@ -2267,13 +2293,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                 RealtimeData realtimeData = new RealtimeData();
 
                 log.info("🔍 【流量类型判断】");
-                if (opcData.getPointName().contains(SubscribeTagConstants.TAG_IRON_WEIGHT11(opcData.getServerType()))) {
-                    log.info("   ├─ 📍 检测到 TAG_IRON_WEIGHT11 - 1号车铁水流量");
-                    realtimeData.setValue(1);
-                } else {
-                    log.info("   ├─ 📍 检测到 TAG_IRON_WEIGHT12 - 2号车铁水流量");
-                    realtimeData.setValue(2);
-                }
+
 
                 log.info("💧 【流量计算逻辑】");
                 log.info("   ├─ 当前流量值: {} t", bigDecimalNew.toPlainString());
@@ -2283,8 +2303,10 @@ public class DeviceEventListener extends AbstractEventListener { //
                 if (ironLoading1.get() > 0) {
                     log.info("   ├─ ✅ 出铁状态活跃,执行流量累加逻辑");
 
-                    if (bigDecimalNew.compareTo(BigDecimal.ZERO) >= 0) {
-                        log.info("   ├─ ✅ 流量值有效 (≥ 0)");
+                    if (opcData.getPointName().contains(SubscribeTagConstants.TAG_IRON_WEIGHT11(opcData.getServerType()))) {
+                        log.info("   ├─ 📍 检测到 TAG_IRON_WEIGHT11 - 1号车铁水流量");
+                        realtimeData.setValue(1);
+
 
                         BigDecimal diff = ironWeight1Pre.subtract(bigDecimalNew);
                         log.info("   ├─ 计算差值: {} - {} = {}", ironWeight1Pre, bigDecimalNew, diff);
@@ -2293,6 +2315,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                             log.info("   ├─ 🔄 检测到满载流量变化 (差值 > 130t)");
                             log.info("   ├─ 累加前总流量: {} t", mTotalWeight);
 
+
                             mTotalWeight = mTotalWeight.add(ironWeight1Pre);
 
                             log.info("   ├─ ✅ 累加后总流量: {} t", mTotalWeight);
@@ -2305,21 +2328,58 @@ public class DeviceEventListener extends AbstractEventListener { //
                             log.info("   ├─ ⏭️ 未达到满载阈值 (差值 ≤ 130t),跳过累加");
                             log.info("   ├─ 当前差值: {} t ≤ 130 t", diff);
                         }
+
+
+                        // 更新上次流量值
+                        log.info("   ├─ 📝 更新上次流量值: {} → {}", ironWeight1Pre, bigDecimalNew);
+                        ironWeight1Pre = bigDecimalNew;
+
                     } else {
-                        log.warn("   ├─ ⚠️ 流量值异常 (< 0): {} t", bigDecimalNew);
-                    }
+                        log.info("   ├─ 📍 检测到 TAG_IRON_WEIGHT12 - 2号车铁水流量");
+                        realtimeData.setValue(2);
 
-                    // 更新上次流量值
-                    log.info("   ├─ 📝 更新上次流量值: {} → {}", ironWeight1Pre, bigDecimalNew);
-                    ironWeight1Pre = bigDecimalNew;
 
-                    //剩余铁量计算-流量
-                    getCloseTime();
+                        BigDecimal diff = ironWeight2Pre.subtract(bigDecimalNew);
+                        log.info("   ├─ 计算差值: {} - {} = {}", ironWeight2Pre, bigDecimalNew, diff);
+
+                        if (diff.compareTo(new BigDecimal("130")) > 0) {
+                            log.info("   ├─ 🔄 检测到满载流量变化 (差值 > 130t)");
+                            log.info("   ├─ 累加前总流量: {} t", mTotalWeight);
+
+
+                            mTotalWeight = mTotalWeight.add(ironWeight2Pre);
+
+                            log.info("   ├─ ✅ 累加后总流量: {} t", mTotalWeight);
+                            log.info("   ├─ 📊 本次累加流量: {} t", ironWeight2Pre);
+                            log.info("   ├─ 📊 累计总流量: {} t", mTotalWeight);
+
+                            log.info("铁水总流量:{},2号线铁水满载流量:{},下一个流量:{}",
+                                    mTotalWeight, ironWeight2Pre, bigDecimalNew);
+                        } else {
+                            log.info("   ├─ ⏭️ 未达到满载阈值 (差值 ≤ 130t),跳过累加");
+                            log.info("   ├─ 当前差值: {} t ≤ 130 t", diff);
+                        }
+
+                        // 更新上次流量值
+                        log.info("   ├─ 📝 更新上次流量值: {} → {}", ironWeight2Pre, bigDecimalNew);
+                        ironWeight2Pre = bigDecimalNew;
+                    }
+
                 } else {
                     log.info("   ├─ ⏸️ 出铁状态未激活,流量值设为0");
+                    mTotalWeight = mTotalWeight.add(ironWeight1Pre);
+                    log.info("出铁结束,铁水总流量:{},1号线剩余铁水流量:{}",
+                            mTotalWeight, ironWeight1Pre);
+                    mTotalWeight = mTotalWeight.add(ironWeight2Pre);
+                    log.info("出铁结束,铁水总流量:{},2号线剩余铁水流量:{}",
+                            mTotalWeight, ironWeight2Pre);
+
                     realtimeData.setValue(0);
                 }
 
+                //剩余铁量计算-流量
+                getCloseTime();
+
                 log.info("📋 【实时数据构建】");
                 realtimeData.setDesc("摆动溜嘴的摆动方向");
                 realtimeData.setExtra(opcData.getData());
@@ -2496,7 +2556,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                                 log.warn("开口机超时告警触发 - 实际耗时:{}分钟 > 标准:{}分钟",
                                         minutesDiff, StandardConstans.STANDARD_OPEN_HOUR);
                                 String warnMsg = String.format("开口耗时:%s分钟", minutesDiff);
-                                WarnData.warnOpen(warnMsg, audioMap.get(ExceptionTypeEnum.OPEN_HOUR_LONG.getCode()));
+                                PushData.send2Warn(audioMap.get(ExceptionTypeEnum.OPEN_HOUR_LONG.getCode()));
                                 log.warn("已发送开口机超时预警: {}", warnMsg);
                                 saveException(ExceptionTypeEnum.OPEN_HOUR_LONG, warnMsg);
                                 log.warn("已记录开口机超时异常: {}", warnMsg);

+ 30 - 0
taphole-warn/src/main/java/com/sckj/warn/dto/TAudioDTO.java

@@ -0,0 +1,30 @@
+package com.sckj.warn.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@ApiModel("音频实体")
+public class TAudioDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "音频名称")
+    private String name;
+
+    @ApiModelProperty(value = "异常类型")
+    private String exceptionType;
+
+    @ApiModelProperty(value = "危害程度")
+    private String exceptionLevel;
+
+    @ApiModelProperty(value = "音频地址")
+    private String alarmUrl;
+
+    @ApiModelProperty(value = "状态(1正常 0停用)")
+    private String status;
+
+}