Pārlūkot izejas kodu

预测保存当前真实值的调整、 取最新工业数据和化验数据调整

wangmiaomiao 8 mēneši atpakaļ
vecāks
revīzija
cab817b4d9

+ 1 - 0
slibra-common/src/main/java/com/slibra/common/constant/MyConstants.java

@@ -89,6 +89,7 @@ public class MyConstants {
 //    public static final String TP = "tp";//tp
     public static final int MAX_COUNT = 30;
     public static final int INT_2 = 2;
+    public static final int INT_6 = 6;
     public static final int INT_10000 = 10000;//10秒钟
     public static final int MAX_QUESTION_LENGTH = 5000;
 

+ 18 - 9
slibra-quartz/src/main/java/com/slibra/quartz/task/RyTask.java

@@ -681,8 +681,14 @@ public class RyTask
      */
     public void predictor(){
         //获取最新的6条工业科数据
-        List<TXinyiIndustry> tXinyiIndustries6 = this.xinyiIndustryMapper.selectNIndustry(6);
-        List<TXinyiRobot> tXinyiRobots6 = this.xinyiRobotMapper.selectNRobot(6);
+        List<TXinyiIndustry> tXinyiIndustries6 = this.xinyiIndustryMapper.selectNIndustry(INT_6);
+        List<TXinyiRobot> tXinyiRobots6 = this.xinyiRobotMapper.selectNRobot(INT_6);
+        //2024年7月18日10:31:18  加个校验,只有从来没有数据的水厂才会进入下面的判断
+        if(CollectionUtils.isEmpty(tXinyiIndustries6) || tXinyiIndustries6.size() < INT_6
+            || CollectionUtils.isEmpty(tXinyiRobots6) || tXinyiRobots6.size() <INT_6){
+            log.error("预测的时候,获取最新的6条工业数据或者化验数据不满足,任务终止,工业数据为{}\n化验数据为{}", JSON.toJSONString(tXinyiIndustries6), JSON.toJSONString(tXinyiRobots6));
+            return;
+        }
         //先处理xsy1 和 xsy2 合并成一个数据
 //        this.predictorSpecial(tXinyiIndustries6, tXinyiRobots6);
         //2024年7月11日16:55:27  xsy1 和 xsy2 又不合并了。。。 再次分开处理
@@ -939,7 +945,10 @@ public class RyTask
         }
         TXinyiNormConfig normConfig = tXinyiNormConfigs.get(0);
         //获取最新的工业库的数据
-        TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest();
+//        TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest();
+        //2024年7月18日10:29:44  因为获取了最新的六条数据,所以无需再查询最新的数据了
+        TXinyiIndustry tXinyiIndustry = tXinyiIndustries6.get(0);
+        TXinyiRobot tXinyiRobot = tXinyiRobots6.get(0);
         List<ChartBasic> chartsDataList = new ArrayList<>(9);
         if(BusinessEnum.BigModelForecastEnum.COD.getCode().equals(task)){
             //同时调用跃渊的预测接口 保存记录值
@@ -972,7 +981,7 @@ public class RyTask
                 chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
                 chartsDataList.add(chartBasic);
             }
-            handleXinYiWarningsYC(cscodBzz, split, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_COD_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsCod(), tXinyiIndustry, chartsDataList, date);
+            handleXinYiWarningsYC(cscodBzz, split, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_COD_YC.getCode(), hour, normConfig, tXinyiIndustry.getCsCod(), tXinyiIndustry, chartsDataList, date);
         }else if(BusinessEnum.BigModelForecastEnum.SS.getCode().equals(task)){
             //同时调用跃渊的预测接口 保存记录值
             try {
@@ -1004,7 +1013,7 @@ public class RyTask
                 chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
                 chartsDataList.add(chartBasic);
             }
-            handleXinYiWarningsYC(csSSBzz, split, csssGkz, BusinessEnum.WarningCategoryEnum.CS_SS_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsSs(), tXinyiIndustry, chartsDataList, date);
+            handleXinYiWarningsYC(csSSBzz, split, csssGkz, BusinessEnum.WarningCategoryEnum.CS_SS_YC.getCode(), hour, normConfig, tXinyiIndustry.getCsSs(), tXinyiIndustry, chartsDataList, date);
         }/*else if(BusinessEnum.BigModelForecastEnum.TN.getCode().equals(task)){
             //同时调用跃渊的预测接口 保存记录值
             try {
@@ -1068,7 +1077,7 @@ public class RyTask
                 chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
                 chartsDataList.add(chartBasic);
             }
-            handleXinYiWarningsYC(cszlBzz, split, cszlGkz, BusinessEnum.WarningCategoryEnum.CS_TP_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsTp(), tXinyiIndustry, chartsDataList, date);
+            handleXinYiWarningsYC(cszlBzz, split, cszlGkz, BusinessEnum.WarningCategoryEnum.CS_TP_YC.getCode(), hour, normConfig, tXinyiRobot.getTpRccJqr(), tXinyiIndustry, chartsDataList, date);
         }else if(BusinessEnum.BigModelForecastEnum.NH3.getCode().equals(task)){
             //同时调用跃渊的预测接口 保存记录值
             try {
@@ -1100,7 +1109,7 @@ public class RyTask
                 chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
                 chartsDataList.add(chartBasic);
             }
-            handleXinYiWarningsYC(csadBzz, split, csadGkz, BusinessEnum.WarningCategoryEnum.CS_AD_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsNh3(), tXinyiIndustry, chartsDataList, date);
+            handleXinYiWarningsYC(csadBzz, split, csadGkz, BusinessEnum.WarningCategoryEnum.CS_AD_YC.getCode(), hour, normConfig, tXinyiIndustry.getCsNh3(), tXinyiIndustry, chartsDataList, date);
         }else if(BusinessEnum.BigModelForecastEnum.XSY1.getCode().equals(task)){
             //2024年6月21日14:57:02 红杉的出水总氮预测改成 不用工业库的,用化验科的两个xsy 相关指标
             //同时调用跃渊的预测接口 保存记录值
@@ -1136,7 +1145,7 @@ public class RyTask
                 chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
                 chartsDataList.add(chartBasic);
             }
-            handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_XSY_1_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsCod(), tXinyiIndustry, chartsDataList, date);
+            handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_XSY_1_YC.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj1Jqr(), tXinyiIndustry, chartsDataList, date);
         }else if(BusinessEnum.BigModelForecastEnum.XSY2.getCode().equals(task)){
             //同时调用跃渊的预测接口 保存记录值
             try {
@@ -1171,7 +1180,7 @@ public class RyTask
                 chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
                 chartsDataList.add(chartBasic);
             }
-            handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_XSY_2_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsCod(), tXinyiIndustry, chartsDataList, date);
+            handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_XSY_2_YC.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj2Jqr(), tXinyiIndustry, chartsDataList, date);
         }else {
             log.error("暂未支持的类型{}", task);
         }