فهرست منبع

新增几个接口 手动触发报警

王苗苗 7 ماه پیش
والد
کامیت
3ad6f9a529

+ 397 - 0
slibra-admin/src/main/java/com/slibra/web/controller/business/HandleDataController.java

@@ -2,15 +2,23 @@ package com.slibra.web.controller.business;
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpUtil;
 import cn.hutool.poi.excel.ExcelReader;
 import cn.hutool.poi.excel.ExcelUtil;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
 import com.slibra.business.domain.*;
 import com.slibra.business.mapper.*;
+import com.slibra.business.res.ChartBasic;
+import com.slibra.common.DecimalUtils;
 import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.common.core.controller.BaseController;
+import com.slibra.common.enums.BusinessEnum;
 import com.slibra.common.utils.DateUtils;
+import com.slibra.common.utils.StringUtils;
+import com.slibra.quartz.task.AsyncTask;
+import com.slibra.quartz.task.RyTask;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.session.ExecutorType;
 import org.apache.ibatis.session.SqlSession;
@@ -29,6 +37,7 @@ import java.util.*;
 
 import static com.slibra.common.constant.MyConstants.*;
 import static com.slibra.common.constant.MyConstants.BigDecimal_100;
+import static com.slibra.common.enums.BusinessEnum.WarningCategoryEnum.CS_TP_YC;
 
 /**
  * 参数配置 信息操作处理
@@ -70,9 +79,129 @@ public class HandleDataController extends BaseController
     @Autowired
     private SqlSessionFactory sqlSessionFactory;
 
+    @Autowired
+    private RyTask ryTask;
+
+    @Autowired
+    private AsyncTask asyncTask;
+
 
     public static final String[] queryTags = {"信义污水厂JS_COD_Value","信义污水厂JS_PH_Value","信义污水厂JS_SS_Value","信义污水厂JS_ZL_Value","信义污水厂JS_ZA_Value","信义污水厂JS_AD_Value","信义污水厂JS_T_Value","信义污水厂进水泵房液位","信义污水厂出水瞬时流量","信义污水厂升级出水COD","信义污水厂升级出水PH","信义污水厂升级出水SS","信义污水厂升级出水TN","信义污水厂升级出水TP","信义污水厂升级出水氨氮","信义污水厂AIT202_Value","信义污水厂AIT203_Value","信义污水厂AIT207_Value","信义污水厂AIT206_Value","信义污水厂AIT209_Value","信义污水厂AIT210_Value","信义污水厂进水TDS","信义污水厂FT101_Value","信义污水厂SWCHHYHLB1_R_Value","信义污水厂SWCHHYHLB2_R_Value","信义污水厂SWCHHYHLB3_R_Value","信义污水厂SWCHHYHLB4_R_Value","信义污水厂SWCHHYHLB5_R_Value","信义污水厂SWCHHYHLB6_R_Value","信义污水厂SWCWNHLB1_R_Value","信义污水厂SWCWNHLB2_R_Value","信义污水厂SWCWNHLB3_R_Value","信义污水厂SWCWNHLB4_R_Value","信义污水厂SWCWNHLB5_R_Value","信义污水厂GFJ1_R_Value","信义污水厂GFJ2_R_Value","信义污水厂GFJ3_R_Value","信义污水厂GFJ4_R_Value","信义污水厂GFJ5_R_Value","信义污水厂GFJ6_R_Value","信义污水厂GFJ1_KQLL_Value","信义污水厂GFJ2_KQLL_Value","信义污水厂GFJ3_KQLL_Value","信义污水厂GFJ4_KQLL_Value","信义污水厂GFJ5_KQLL_Value","信义污水厂GFJ6_KQLL_Value"};
 
+    public static final String[] predictorArr = {"出水COD", "出水SS", "出水总磷", "出水氨氮", "xsy1", "xsy2"};
+
+
+    /**
+     *手动处理水质报警
+     */
+   @GetMapping("/waterWarning")
+   public String waterWarning(){
+       log.info("进入了 手动触发水质报警的 操作");
+       //获取配置表
+       List<TXinyiNormConfig> tXinyiNormConfigs = this.xinyiNormConfigMapper.selectTXinyiNormConfigList(null);
+       if(CollectionUtils.isEmpty(tXinyiNormConfigs))
+           throw new RuntimeException("未查询到配置信息");
+       TXinyiNormConfig normConfig = tXinyiNormConfigs.get(0);
+       TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest();
+       if(Objects.isNull(tXinyiIndustry))
+           throw new RuntimeException("未查询到工业库信息");
+       asyncTask.handleSZWarning(tXinyiIndustry, normConfig);
+       return "success";
+   }
+
+
+    /**
+     *手动处理生化报警
+     */
+    @GetMapping("/shWarning")
+    public String shWarning(){
+        log.info("进入了 手动处理生化报警 操作");
+        //获取配置表
+        List<TXinyiNormConfig> tXinyiNormConfigs = this.xinyiNormConfigMapper.selectTXinyiNormConfigList(null);
+        if(CollectionUtils.isEmpty(tXinyiNormConfigs))
+            throw new RuntimeException("未查询到配置信息");
+        TXinyiNormConfig normConfig = tXinyiNormConfigs.get(0);
+        TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest();
+        if(Objects.isNull(tXinyiIndustry))
+            throw new RuntimeException("未查询到工业库信息");
+        List<TXinyiCalculate> tXinyiCalculates = xinyiCalculateMapper.selectTXinyiCalculateList(TXinyiCalculate.builder().testHour(tXinyiIndustry.getTestHour()).build());
+        if (!CollectionUtils.isEmpty(tXinyiCalculates)) {
+            TXinyiCalculate tXinyiCalculate = tXinyiCalculates.get(0);
+            asyncTask.handleSHWarning(tXinyiIndustry, normConfig, tXinyiCalculate);
+        }
+        return "success";
+    }
+
+
+    /**
+     *手动处理化验室报警
+     */
+    @GetMapping("/robotWarning")
+    public String robotWarning(){
+        log.info("进入了 手动触发化验室报警的 操作");
+        asyncTask.handleRobotWarning(this.xinyiRobotMapper.selectNRobot(1));
+        return "success";
+    }
+
+
+    /**
+     *手动处理预测报警
+     */
+    @GetMapping("/forecastWarning")
+    public String forecastWarning(){
+        log.info("进入了 手动触发预测报警的 操作");
+        //获取最新的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 "预测的时候,获取最新的6条工业数据或者化验数据不满足,任务终止";
+        }
+        //先处理xsy1 和 xsy2 合并成一个数据
+//        this.predictorSpecial(tXinyiIndustries6, tXinyiRobots6);
+        //2024年7月11日16:55:27  xsy1 和 xsy2 又不合并了。。。 再次分开处理
+        for (int i = 0; i < predictorArr.length; i++) {
+            String result = ryTask.getPredictor(predictorArr[i]);
+            if(StringUtils.isBlank(result) || "error".equals(result)){
+                log.info("预测数据返回结果不符合解析条件,返回结果为{}", result);
+                continue;
+            }
+            JSONObject jsonObject = null;
+            try {
+                jsonObject = JSON.parseObject(result);
+            } catch (Exception e) {
+                log.error("[转JSON的时候]预测数据返回结果不符合解析条件,返回结果为{}", result);
+                continue;
+            }
+            log.info("^^^^^^^^^^^^^预测接口转弯JSON对象后,原内容是{}", JSON.toJSONString(jsonObject));
+            //2024年7月8日15:25:51 加个校验 因为各种奇葩返回。。 比如返回的结果是 "null"
+            if(Objects.isNull(jsonObject)){
+                log.error("[转JSON的时候]预测数据返回结果是null,不处里");
+                continue;
+            }
+            String task = jsonObject.getString("task");
+            String hour = jsonObject.getString("hour");
+            String pred = jsonObject.getString("pred");
+            String date = jsonObject.getString("date");
+            if(StringUtils.isNotBlank(pred) && pred.contains(",")){
+                String[] split = pred.split(",");
+                if(split.length != 3){
+                    log.error("预测数据返回结果为{},长度不是3,无法正常解析", result);
+                    //因为部分预测还不支持  所以不需要
+//                    ryTask.handleXinYiWarningsYC(cscodBzz, split, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_COD_YC.getCode(), hour, normConfig);
+                    continue;
+                }
+                //解析数据 处理报警 调研prompt 保存等
+                this.handlePredictorWarning(split, hour, task, tXinyiIndustries6, tXinyiRobots6, date);
+            }else {
+                log.error("预测数据返回结果为{},无法正常解析", result);
+            }
+        }
+        return "success";
+    }
+
     @GetMapping("/dateAdd")
     public String dateAdd() {
 
@@ -1421,5 +1550,273 @@ public class HandleDataController extends BaseController
         tXinyiBigTableHour.setHyHyzlsyAll(tXinyiRobot.getHyzlsyAll());
     }
 
+
+    private void handlePredictorWarning(String[] split, String hour, String task, List<TXinyiIndustry> tXinyiIndustries6, List<TXinyiRobot> tXinyiRobots6, String date) {
+        String[] hours = hour.split(",");
+        //2024年6月23日18:28:55 因为存在跨天问题  所以日期也是逗号拼接的
+        String[] dates = date.split(",");
+        //2024年6月18日13:41:10 统一格式,否则查询不到结果
+        //2024年6月18日10:36:49 增加预测记录,预测准确度计算等
+        TXinyiForecastComparison tXinyiForecastComparison = new TXinyiForecastComparison();
+        //2024年7月11日17:04:11 TP改为zlsy
+        tXinyiForecastComparison.setCategory(BusinessEnum.BigModelForecastEnum.TP.getCode().equalsIgnoreCase(task) ? BusinessEnum.BigModelForecastEnum.ZLSY.getCode() : task);
+        tXinyiForecastComparison.setForecastTimeOne(dates[0].replaceAll("-", "/") + " " + hours[0]);
+        tXinyiForecastComparison.setForecastTimeTwo(dates[1].replaceAll("-", "/") + " " + hours[1]);
+        tXinyiForecastComparison.setForecastTimeThree(dates[2].replaceAll("-", "/") + " " + hours[2]);
+        tXinyiForecastComparison.setHsForecastOne(new BigDecimal(split[0]));
+        tXinyiForecastComparison.setHsForecastTwo(new BigDecimal(split[1]));
+        tXinyiForecastComparison.setHsForecastThree(new BigDecimal(split[2]));
+        //2024年6月20日14:28:31  增加字段,方便查询
+        tXinyiForecastComparison.setRemark(DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYYMMDDHH_TS));
+
+
+        //获取配置表
+        List<TXinyiNormConfig> tXinyiNormConfigs = this.xinyiNormConfigMapper.selectTXinyiNormConfigList(null);
+        if(CollectionUtils.isEmpty(tXinyiNormConfigs)) {
+            log.error( "未查询到配置信息");
+            return;
+        }
+        TXinyiNormConfig normConfig = tXinyiNormConfigs.get(0);
+        //获取最新的工业库的数据
+//        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)){
+            //同时调用跃渊的预测接口 保存记录值
+            try {
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=2&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
+                if(!StringUtils.isBlank(result)){
+                    JSONArray array = JSON.parseArray(result);
+                    tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
+                    tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
+                    tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
+                }
+            } catch (Exception e) {
+                log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
+            }
+            // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
+            BigDecimal cscodBzz = normConfig.getCscodBzz();
+            BigDecimal cscodGkz = normConfig.getCscodGkz();
+            //处理展示数据
+            for (int i = 0; i < tXinyiIndustries6.size(); i++) {
+                TXinyiIndustry tXinyiIndustryTemp = tXinyiIndustries6.get(5 - i);
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(tXinyiIndustryTemp.getTestHour().substring(11));
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiIndustryTemp.getCsCod(), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            for (int i = 0; i < split.length; i++) {
+                String val = split[i];
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(hours[i]);
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            ryTask.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 {
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=5&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
+                if(!StringUtils.isBlank(result)){
+                    JSONArray array = JSON.parseArray(result);
+                    tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
+                    tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
+                    tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
+                }
+            } catch (Exception e) {
+                log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
+            }
+            // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
+            BigDecimal csSSBzz = normConfig.getCsssBzz();
+            BigDecimal csssGkz = normConfig.getCsssGkz();
+            //处理展示数据
+            for (int i = 0; i < tXinyiIndustries6.size(); i++) {
+                TXinyiIndustry tXinyiIndustryTemp = tXinyiIndustries6.get(5 - i);
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(tXinyiIndustryTemp.getTestHour().substring(11));
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiIndustryTemp.getCsSs(), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            for (int i = 0; i < split.length; i++) {
+                String val = split[i];
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(hours[i]);
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            ryTask.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 {
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=3&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10);
+                if(!StringUtils.isBlank(result)){
+                    JSONArray array = JSON.parseArray(result);
+                    tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
+                    tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
+                    tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
+                }
+            } catch (Exception e) {
+                log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
+            }
+            // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
+            BigDecimal cszzBzz = normConfig.getCszzBzz();
+            BigDecimal cszzGkz = normConfig.getCszzGkz();
+            //处理展示数据
+            for (int i = 0; i < tXinyiIndustries6.size(); i++) {
+                TXinyiIndustry tXinyiIndustryTemp = tXinyiIndustries6.get(5 - i);
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(tXinyiIndustryTemp.getTestHour().substring(11));
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiIndustryTemp.getCsTn(), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            for (int i = 0; i < split.length; i++) {
+                String val = split[i];
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(hours[i]);
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            ryTask.handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_TN_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsCod(), tXinyiIndustry, chartsDataList, date);
+        }*/else if(BusinessEnum.BigModelForecastEnum.TP.getCode().equals(task)){
+            //同时调用跃渊的预测接口 保存记录值
+            try {
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=1&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
+                if(!StringUtils.isBlank(result)){
+                    JSONArray array = JSON.parseArray(result);
+                    tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
+                    tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
+                    tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
+                }
+            } catch (Exception e) {
+                log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
+            }
+            // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
+            BigDecimal cszlBzz = normConfig.getCszlBzz();
+            BigDecimal cszlGkz = normConfig.getCszlGkz();
+            //处理展示数据
+            for (int i = 0; i < tXinyiRobots6.size(); i++) {
+                TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getTpRccJqr(), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            for (int i = 0; i < split.length; i++) {
+                String val = split[i];
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(hours[i]);
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            ryTask.handleXinYiWarningsYC(cszlBzz, split, cszlGkz, CS_TP_YC.getCode(), hour, normConfig, tXinyiRobot.getTpRccJqr(), tXinyiIndustry, chartsDataList, date);
+        }else if(BusinessEnum.BigModelForecastEnum.NH3.getCode().equals(task)){
+            //同时调用跃渊的预测接口 保存记录值
+            try {
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=4&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
+                if(!StringUtils.isBlank(result)){
+                    JSONArray array = JSON.parseArray(result);
+                    tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
+                    tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
+                    tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
+                }
+            } catch (Exception e) {
+                log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
+            }
+            // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
+            BigDecimal csadBzz = normConfig.getCsadBzz();
+            BigDecimal csadGkz = normConfig.getCsadGkz();
+            //处理展示数据
+            for (int i = 0; i < tXinyiIndustries6.size(); i++) {
+                TXinyiIndustry tXinyiIndustryTemp = tXinyiIndustries6.get(5 - i);
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(tXinyiIndustryTemp.getTestHour().substring(11));
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiIndustryTemp.getCsNh3(), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            for (int i = 0; i < split.length; i++) {
+                String val = split[i];
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(hours[i]);
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            ryTask.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 相关指标
+            //同时调用跃渊的预测接口 保存记录值
+            try {
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=6&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
+                if(!StringUtils.isBlank(result)){
+                    JSONArray array = JSON.parseArray(result);
+                    tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
+                    tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
+                    tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
+                }
+            } catch (Exception e) {
+                log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
+            }
+            // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
+            /*BigDecimal cscodBzz = new BigDecimal(XIAOSUANYAN_BZK);
+            BigDecimal cscodGkz = new BigDecimal(XIAOSUANYAN_GKZ);*/
+            //2024年7月11日17:19:47  1#好氧硝酸盐、2#好氧硝酸盐使用总氮标准值和管控值来预警
+            BigDecimal cszzBzz = normConfig.getCszzBzz();
+            BigDecimal cszzGkz = normConfig.getCszzGkz();
+            //处理展示数据
+            for (int i = 0; i < tXinyiRobots6.size(); i++) {
+                TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getNo3Hlj1Jqr(), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            for (int i = 0; i < split.length; i++) {
+                String val = split[i];
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(hours[i]);
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            ryTask.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 {
+                String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=7&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
+                if(!StringUtils.isBlank(result)){
+                    JSONArray array = JSON.parseArray(result);
+                    tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
+                    tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
+                    tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
+                }
+            } catch (Exception e) {
+                log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
+            }
+            // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
+            /*BigDecimal cscodBzz = new BigDecimal(XIAOSUANYAN_BZK);
+            BigDecimal cscodGkz = new BigDecimal(XIAOSUANYAN_GKZ);*/
+            //2024年7月11日17:19:47  1#好氧硝酸盐、2#好氧硝酸盐使用总氮标准值和管控值来预警
+            BigDecimal cszzBzz = normConfig.getCszzBzz();
+            BigDecimal cszzGkz = normConfig.getCszzGkz();
+            //处理展示数据
+            for (int i = 0; i < tXinyiRobots6.size(); i++) {
+                TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getNo3Hlj2Jqr(), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            for (int i = 0; i < split.length; i++) {
+                String val = split[i];
+                ChartBasic chartBasic = new ChartBasic();
+                chartBasic.setTime(hours[i]);
+                chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
+                chartsDataList.add(chartBasic);
+            }
+            ryTask.handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_XSY_2_YC.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj2Jqr(), tXinyiIndustry, chartsDataList, date);
+        }else {
+            log.error("暂未支持的类型{}", task);
+        }
+    }
 }
 

+ 2 - 2
slibra-quartz/src/main/java/com/slibra/quartz/task/AsyncTask.java

@@ -826,7 +826,7 @@ public class AsyncTask {
         return tXinyiCalculate;
     }
 
-    private void handleSHWarning(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, TXinyiCalculate xinyiCalculate) {
+    public void handleSHWarning(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, TXinyiCalculate xinyiCalculate) {
         //判断对应指标是否报警  然后调研大模型获取决策信息
 //        BigDecimal jsSlq = tXinyiIndustry.getJsSlq();
         //内回流比报警
@@ -1097,7 +1097,7 @@ public class AsyncTask {
     }
 
 
-    private void handleSZWarning(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+    public void handleSZWarning(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
         //出水相关
         //出水COD报警
         BigDecimal csCod = tXinyiIndustry.getCsCod();

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

@@ -1352,7 +1352,7 @@ public class RyTask
             this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
     }
 
-    private void handleXinYiWarningsYC(BigDecimal csBzz, String[] split, BigDecimal csGkz, String category, String hour, TXinyiNormConfig normConfig, BigDecimal currentVal, TXinyiIndustry tXinyiIndustry, List<ChartBasic> chartsDataList, String date) {
+    public void handleXinYiWarningsYC(BigDecimal csBzz, String[] split, BigDecimal csGkz, String category, String hour, TXinyiNormConfig normConfig, BigDecimal currentVal, TXinyiIndustry tXinyiIndustry, List<ChartBasic> chartsDataList, String date) {
         BigDecimal multiply = csBzz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
         TXinyiWarningRecord tXinyiWarningRecord = null;
         String yjHour = null;