Răsfoiți Sursa

保存预测结果的时候 xsy1和xys2的真实值分开获取

wangmiaomiao 8 luni în urmă
părinte
comite
ab107dca73

+ 1 - 1
slibra-admin/src/main/java/com/slibra/web/controller/business/GRPCController.java

@@ -509,7 +509,7 @@ public class GRPCController extends BaseController {
         chatRequest.setExtra(extra);
         chatRequest.setStrengthen(isStrong == 1);
         chatRequest.setTools(String.valueOf(tools));
-        chatRequest.setUseRag(String.valueOf(useRag));
+        chatRequest.setUseRag(useRag);
         return JSON.toJSONString(chatRequest);
     }
 

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

@@ -442,7 +442,6 @@ public class AsyncTask {
     /**
      * 额外计算一下预测的准确度
      * @param tXinyiRobot
-     * todo xxxxx
      */
     public void updateForecastComparisonByRobot(TXinyiRobot tXinyiRobot) {
         BigDecimal no3Hlj1Jqr = tXinyiRobot.getNo3Hlj1Jqr();
@@ -451,15 +450,16 @@ public class AsyncTask {
 
         BigDecimal tpRccJqr = tXinyiRobot.getTpRccJqr();
         BigDecimal csTp = null;
-        BigDecimal csTn = null;
+//        BigDecimal csTn = null;
         if(!Objects.isNull(tpRccJqr)){
             csTp = tpRccJqr.divide(ROBOT_HY_DIVIDE, NUMBER_SCALE_4, RoundingMode.HALF_UP);
             //2024年6月20日13:44:26  先不计算,结果会更准确
             //2024年6月21日14:23:14  就是要 除以0.8
 //            csTp = tpRccJqr;
         }
-        if(!Objects.isNull(no3Hlj1Jqr) && !Objects.isNull(no3Hlj2Jqr))
-            csTn = (no3Hlj1Jqr.add(no3Hlj2Jqr)).divide(DECIMAL_2, NUMBER_SCALE_4, RoundingMode.HALF_UP).divide(ROBOT_HY_DIVIDE, NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        //2024年7月12日16:29:00  需要单独计算了 csTn不再合并,分别从两个池子获取。。。
+//        if(!Objects.isNull(no3Hlj1Jqr) && !Objects.isNull(no3Hlj2Jqr))
+//            csTn = (no3Hlj1Jqr.add(no3Hlj2Jqr)).divide(DECIMAL_2, NUMBER_SCALE_4, RoundingMode.HALF_UP).divide(ROBOT_HY_DIVIDE, NUMBER_SCALE_4, RoundingMode.HALF_UP);
 
         //时间段1
         List<TXinyiForecastComparison> tXinyiForecastComparisons1 = this.xinyiForecastComparisonMapper.selectTXinyiForecastComparisonList(TXinyiForecastComparison.builder().forecastTimeOne(testHour).build());
@@ -488,18 +488,34 @@ public class AsyncTask {
                 //2024年6月21日17:04:01  总氮的真实值也从化验室获取
                 //2024年7月12日10:31:29  tn又改成xsy1和xsy2了。。。
                 if(BusinessEnum.BigModelForecastEnum.TN.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
-                    || BusinessEnum.BigModelForecastEnum.XSY1.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
+                    || BusinessEnum.BigModelForecastEnum.XSY1.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())){
+                    tXinyiForecastComparison.setRealOne(no3Hlj1Jqr);
+                    if(!Objects.isNull(no3Hlj1Jqr) && no3Hlj1Jqr.compareTo(BigDecimal.ZERO) > 0){
+                        if(!Objects.isNull(hsForecastOne)){
+                            BigDecimal subtract = no3Hlj1Jqr.subtract(hsForecastOne);
+                            tXinyiForecastComparison.setHsErrorRateOne((subtract).divide(no3Hlj1Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            tXinyiForecastComparison.setHsOneSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
+                        }
+                        if(!Objects.isNull(yyForecastOne)){
+                            BigDecimal subtract = no3Hlj1Jqr.subtract(yyForecastOne);
+                            tXinyiForecastComparison.setYyErrorRateOne((subtract).divide(no3Hlj1Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            tXinyiForecastComparison.setYyOneSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
+                        }
+                    }
+                }
+
+                if(BusinessEnum.BigModelForecastEnum.TN.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
                         || BusinessEnum.BigModelForecastEnum.XSY2.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())){
-                    tXinyiForecastComparison.setRealOne(csTn);
-                    if(!Objects.isNull(csTn) && csTn.compareTo(BigDecimal.ZERO) > 0){
+                    tXinyiForecastComparison.setRealOne(no3Hlj2Jqr);
+                    if(!Objects.isNull(no3Hlj2Jqr) && no3Hlj2Jqr.compareTo(BigDecimal.ZERO) > 0){
                         if(!Objects.isNull(hsForecastOne)){
-                            BigDecimal subtract = csTn.subtract(hsForecastOne);
-                            tXinyiForecastComparison.setHsErrorRateOne((subtract).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            BigDecimal subtract = no3Hlj2Jqr.subtract(hsForecastOne);
+                            tXinyiForecastComparison.setHsErrorRateOne((subtract).divide(no3Hlj2Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
                             tXinyiForecastComparison.setHsOneSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
                         }
                         if(!Objects.isNull(yyForecastOne)){
-                            BigDecimal subtract = csTn.subtract(yyForecastOne);
-                            tXinyiForecastComparison.setYyErrorRateOne((subtract).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            BigDecimal subtract = no3Hlj2Jqr.subtract(yyForecastOne);
+                            tXinyiForecastComparison.setYyErrorRateOne((subtract).divide(no3Hlj2Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
                             tXinyiForecastComparison.setYyOneSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
                         }
                     }
@@ -553,18 +569,34 @@ public class AsyncTask {
                 //2024年6月21日17:04:01  总氮的真实值也从化验室获取
                 //2024年7月12日10:31:29  tn又改成xsy1和xsy2了。。。
                 if(BusinessEnum.BigModelForecastEnum.TN.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
-                        || BusinessEnum.BigModelForecastEnum.XSY1.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
+                        || BusinessEnum.BigModelForecastEnum.XSY1.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())){
+                    tXinyiForecastComparison.setRealTwo(no3Hlj1Jqr);
+                    if(!Objects.isNull(no3Hlj1Jqr) && no3Hlj1Jqr.compareTo(BigDecimal.ZERO) > 0){
+                        if(!Objects.isNull(hsForecastTwo)){
+                            BigDecimal subtract = no3Hlj1Jqr.subtract(hsForecastTwo);
+                            tXinyiForecastComparison.setHsErrorRateTwo((subtract).divide(no3Hlj1Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            tXinyiForecastComparison.setHsTwoSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
+                        }
+                        if(!Objects.isNull(yyForecastTwo)){
+                            BigDecimal subtract = no3Hlj1Jqr.subtract(yyForecastTwo);
+                            tXinyiForecastComparison.setYyErrorRateTwo((subtract).divide(no3Hlj1Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            tXinyiForecastComparison.setYyTwoSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
+                        }
+                    }
+                }
+
+                if(BusinessEnum.BigModelForecastEnum.TN.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
                         || BusinessEnum.BigModelForecastEnum.XSY2.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())){
-                    tXinyiForecastComparison.setRealTwo(csTn);
-                    if(!Objects.isNull(csTn) && csTn.compareTo(BigDecimal.ZERO) > 0){
+                    tXinyiForecastComparison.setRealTwo(no3Hlj2Jqr);
+                    if(!Objects.isNull(no3Hlj2Jqr) && no3Hlj2Jqr.compareTo(BigDecimal.ZERO) > 0){
                         if(!Objects.isNull(hsForecastTwo)){
-                            BigDecimal subtract = csTn.subtract(hsForecastTwo);
-                            tXinyiForecastComparison.setHsErrorRateTwo((subtract).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            BigDecimal subtract = no3Hlj2Jqr.subtract(hsForecastTwo);
+                            tXinyiForecastComparison.setHsErrorRateTwo((subtract).divide(no3Hlj2Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
                             tXinyiForecastComparison.setHsTwoSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
                         }
                         if(!Objects.isNull(yyForecastTwo)){
-                            BigDecimal subtract = csTn.subtract(yyForecastTwo);
-                            tXinyiForecastComparison.setYyErrorRateTwo((subtract).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            BigDecimal subtract = no3Hlj2Jqr.subtract(yyForecastTwo);
+                            tXinyiForecastComparison.setYyErrorRateTwo((subtract).divide(no3Hlj2Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
                             tXinyiForecastComparison.setYyTwoSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
                         }
                     }
@@ -618,18 +650,34 @@ public class AsyncTask {
                 //2024年6月21日17:04:01  总氮的真实值也从化验室获取
                 //2024年7月12日10:31:29  tn又改成xsy1和xsy2了。。。
                 if(BusinessEnum.BigModelForecastEnum.TN.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
-                        || BusinessEnum.BigModelForecastEnum.XSY1.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
+                        || BusinessEnum.BigModelForecastEnum.XSY1.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())){
+                    tXinyiForecastComparison.setRealThree(no3Hlj1Jqr);
+                    if(!Objects.isNull(no3Hlj1Jqr) && no3Hlj1Jqr.compareTo(BigDecimal.ZERO) > 0){
+                        if(!Objects.isNull(hsForecastThree)){
+                            BigDecimal subtract = no3Hlj1Jqr.subtract(hsForecastThree);
+                            tXinyiForecastComparison.setHsErrorRateThree((subtract).divide(no3Hlj1Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            tXinyiForecastComparison.setHsThreeSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
+                        }
+                        if(!Objects.isNull(yyForecastThree)){
+                            BigDecimal subtract = no3Hlj1Jqr.subtract(yyForecastThree);
+                            tXinyiForecastComparison.setYyErrorRateThree((subtract).divide(no3Hlj1Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            tXinyiForecastComparison.setYyThreeSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
+                        }
+                    }
+                }
+
+                if(BusinessEnum.BigModelForecastEnum.TN.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())
                         || BusinessEnum.BigModelForecastEnum.XSY2.getCode().equalsIgnoreCase(tXinyiForecastComparison.getCategory())){
-                    tXinyiForecastComparison.setRealThree(csTn);
-                    if(!Objects.isNull(csTn) && csTn.compareTo(BigDecimal.ZERO) > 0){
+                    tXinyiForecastComparison.setRealThree(no3Hlj2Jqr);
+                    if(!Objects.isNull(no3Hlj2Jqr) && no3Hlj2Jqr.compareTo(BigDecimal.ZERO) > 0){
                         if(!Objects.isNull(hsForecastThree)){
-                            BigDecimal subtract = csTn.subtract(hsForecastThree);
-                            tXinyiForecastComparison.setHsErrorRateThree((subtract).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            BigDecimal subtract = no3Hlj2Jqr.subtract(hsForecastThree);
+                            tXinyiForecastComparison.setHsErrorRateThree((subtract).divide(no3Hlj2Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
                             tXinyiForecastComparison.setHsThreeSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
                         }
                         if(!Objects.isNull(yyForecastThree)){
-                            BigDecimal subtract = csTn.subtract(yyForecastThree);
-                            tXinyiForecastComparison.setYyErrorRateThree((subtract).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+                            BigDecimal subtract = no3Hlj2Jqr.subtract(yyForecastThree);
+                            tXinyiForecastComparison.setYyErrorRateThree((subtract).divide(no3Hlj2Jqr, NUMBER_SCALE_4, RoundingMode.HALF_UP));
                             tXinyiForecastComparison.setYyThreeSubtract(DecimalUtils.getAbsAndScale(subtract, INT_2));
                         }
                     }

+ 2 - 1
slibra-system/src/main/java/com/slibra/business/req/ChatRequest.java

@@ -25,8 +25,9 @@ public class ChatRequest {
     @JSONField(name = "session_id")
     private String sessionId;
 
+    //2024年7月12日16:37:32  由字符串改成布尔类型
     @JSONField(name = "use_rag")
-    private String useRag = "false";//2024年7月12日15:25:44  只有问答才传true,其他默认都false
+    private Boolean useRag = false;//2024年7月12日15:25:44  只有问答才传true,其他默认都false
 
     @JSONField(name = "prompt")
     private String prompt = "你是LibraAI水务大模型,由红杉天枰开发的水务垂直大语言模型,能够提供水务行业专家问答、智能决策、报表分析、智能工单管理等一系列功能,作为水务人的AI助手,你会竭尽全力帮助我处理工作问题。";