瀏覽代碼

展示showval时 进水吹水分开处理 只有水质报警才显示报警级别

wangmiaomiao 9 月之前
父節點
當前提交
4aedde7065

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

@@ -200,6 +200,7 @@ public class GRPCController extends BaseController {
             log.error("处理大模型推理异常,异常信息为{}", JSON.toJSONString(e));
             log.error("处理大模型推理异常,异常信息为{}", JSON.toJSONString(e));
             //出现异常 给前端返回一句话
             //出现异常 给前端返回一句话
             try {
             try {
+                outputStream = response.getOutputStream();
                 String errMsg = this.buildErrMsg();
                 String errMsg = this.buildErrMsg();
                 outputStream.write(errMsg.getBytes());
                 outputStream.write(errMsg.getBytes());
                 outputStream.flush();
                 outputStream.flush();

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

@@ -9,11 +9,11 @@ import com.slibra.business.mapper.*;
 import com.slibra.business.req.ChatReq;
 import com.slibra.business.req.ChatReq;
 import com.slibra.business.req.DecisionReq;
 import com.slibra.business.req.DecisionReq;
 import com.slibra.business.req.PolicyReq;
 import com.slibra.business.req.PolicyReq;
-import com.slibra.business.res.ShowValueBasic;
+import com.slibra.business.res.ShowValueCSBasic;
+import com.slibra.business.res.ShowValueJSBasic;
 import com.slibra.common.constant.MyConstants;
 import com.slibra.common.constant.MyConstants;
 import com.slibra.common.enums.BusinessEnum;
 import com.slibra.common.enums.BusinessEnum;
 import com.slibra.common.utils.DateUtils;
 import com.slibra.common.utils.DateUtils;
-import com.slibra.common.utils.StringUtils;
 import com.slibra.common.utils.uuid.IdUtils;
 import com.slibra.common.utils.uuid.IdUtils;
 import inference.InferenceAPIsServiceGrpc;
 import inference.InferenceAPIsServiceGrpc;
 import inference.PredictionResponse;
 import inference.PredictionResponse;
@@ -1018,32 +1018,59 @@ public class AsyncTask {
         //2024年5月27日14:04:22  额外返回2个字段 [管控值 和 告警级别]  返回的json没有数据是因为value没有值
         //2024年5月27日14:04:22  额外返回2个字段 [管控值 和 告警级别]  返回的json没有数据是因为value没有值
 //        basic.put("管控值", tXinyiWarningRecord.getControlVal());
 //        basic.put("管控值", tXinyiWarningRecord.getControlVal());
         basic.put("告警级别", tXinyiWarningRecord.getLevel());*/
         basic.put("告警级别", tXinyiWarningRecord.getLevel());*/
-        ShowValueBasic showValueBasic = new ShowValueBasic();
-        if("0".equals(remark)){//水质报警
-            showValueBasic.setH("在线仪表");
-            showValueBasic.setF(tXinyiWarningRecord.getLevel());
-        }else if("1".equals(remark)){//生化报警
-            showValueBasic.setH("在线仪表");
-        }else if("2".equals(remark)){//预测报错
-            showValueBasic.setH("预测");
-            showValueBasic.setF(tXinyiWarningRecord.getLevel());
-        }else {//机器人化验室报警
-            showValueBasic.setH("化验室");
-            showValueBasic.setF(tXinyiWarningRecord.getLevel());
+        //2024年6月25日16:00:18 进出水展示的不一样
+        if(tXinyiWarningRecord.getCategory().contains("出水")){//出水的展示
+            ShowValueCSBasic showValueCSBasic = new ShowValueCSBasic();
+            if("0".equals(remark)){//水质报警
+                showValueCSBasic.setH("在线仪表");
+                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
+            }else if("1".equals(remark)){//生化报警
+                showValueCSBasic.setH("在线仪表");
+            }else if("2".equals(remark)){//预测报警
+                showValueCSBasic.setH("预测");
+//                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
+            }else {//机器人化验室报警(特殊的水质报警)
+                showValueCSBasic.setH("化验室");
+                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
+            }
+            //通用的
+            //        showValueBasic.setA(tXinyiWarningRecord.getReason());
+            showValueCSBasic.setB(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM ,warningTime));
+            showValueCSBasic.setC(tXinyiWarningRecord.getWarningVal());
+            showValueCSBasic.setD(tXinyiWarningRecord.getControlVal());
+            showValueCSBasic.setE(tXinyiWarningRecord.getDesignVal());
+            showValueCSBasic.setG(Math.min(count, MAX_COUNT));
+            if(tXinyiWarningRecord.getType() != 2)
+                showValueCSBasic.setI(status == 0 ? "报警中" : status == 1 ? "用户关闭" : status == 2 ? "系统关闭" : "应急处理中");
+            else
+                showValueCSBasic.setI(status == 0 ? "预警中" : "已完成");
+            result.put("basic", showValueCSBasic);
+        }else{//进水的展示
+            ShowValueJSBasic showValueJSBasic = new ShowValueJSBasic();
+            if("0".equals(remark)){//水质报警
+                showValueJSBasic.setH("在线仪表");
+                showValueJSBasic.setF(tXinyiWarningRecord.getLevel());
+            }else if("1".equals(remark)){//生化报警
+                showValueJSBasic.setH("在线仪表");
+            }else if("2".equals(remark)){//预测报警
+                showValueJSBasic.setH("预测");
+//                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
+            }else {//机器人化验室报警(特殊的 水质报警)
+                showValueJSBasic.setH("化验室");
+                showValueJSBasic.setF(tXinyiWarningRecord.getLevel());
+            }
+            //通用的
+            //        showValueBasic.setA(tXinyiWarningRecord.getReason());
+            showValueJSBasic.setB(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM ,warningTime));
+            showValueJSBasic.setC(tXinyiWarningRecord.getWarningVal());
+            showValueJSBasic.setE(tXinyiWarningRecord.getDesignVal());
+            showValueJSBasic.setG(Math.min(count, MAX_COUNT));
+            if(tXinyiWarningRecord.getType() != 2)
+                showValueJSBasic.setI(status == 0 ? "报警中" : status == 1 ? "用户关闭" : status == 2 ? "系统关闭" : "应急处理中");
+            else
+                showValueJSBasic.setI(status == 0 ? "预警中" : "已完成");
+            result.put("basic", showValueJSBasic);
         }
         }
-        //通用的
-        //        showValueBasic.setA(tXinyiWarningRecord.getReason());
-        showValueBasic.setB(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM ,warningTime));
-        showValueBasic.setC(tXinyiWarningRecord.getWarningVal());
-        showValueBasic.setD(tXinyiWarningRecord.getControlVal());
-        showValueBasic.setE(tXinyiWarningRecord.getDesignVal());
-        showValueBasic.setG(Math.min(count, MAX_COUNT));
-        if(tXinyiWarningRecord.getType() != 2)
-            showValueBasic.setI(status == 0 ? "报警中" : status == 1 ? "用户关闭" : status == 2 ? "系统关闭" : "应急处理中");
-        else
-            showValueBasic.setI(status == 0 ? "预警中" : "已完成");
-
-        result.put("basic", showValueBasic);
         JSONObject jsData = getJsonObject(tXinyiIndustry, normConfig);//进水数据
         JSONObject jsData = getJsonObject(tXinyiIndustry, normConfig);//进水数据
         result.put("jsData", jsData);
         result.put("jsData", jsData);
         JSONObject csData = getCsonObject(tXinyiIndustry, normConfig);//出水数据
         JSONObject csData = getCsonObject(tXinyiIndustry, normConfig);//出水数据

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

@@ -11,7 +11,6 @@ import com.google.protobuf.ByteString;
 import com.slibra.business.domain.*;
 import com.slibra.business.domain.*;
 import com.slibra.business.mapper.*;
 import com.slibra.business.mapper.*;
 import com.slibra.business.req.ChatReq;
 import com.slibra.business.req.ChatReq;
-import com.slibra.business.req.DecisionReq;
 import com.slibra.business.res.ChartBasic;
 import com.slibra.business.res.ChartBasic;
 import com.slibra.business.res.ShowValueChartBasic;
 import com.slibra.business.res.ShowValueChartBasic;
 import com.slibra.business.service.ITXinyiForecastComparisonService;
 import com.slibra.business.service.ITXinyiForecastComparisonService;
@@ -35,7 +34,6 @@ import org.springframework.util.CollectionUtils;
 
 
 import java.io.IOException;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
@@ -363,7 +361,7 @@ public class RyTask
 
 
 
 
 
 
-    private String buildShowValue(TXinyiWarningRecord tXinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+    private String buildShowValueYJ(TXinyiWarningRecord tXinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
         JSONObject result = new JSONObject();
         JSONObject result = new JSONObject();
         JSONObject basic = new JSONObject();
         JSONObject basic = new JSONObject();
         Integer status = tXinyiWarningRecord.getStatus();
         Integer status = tXinyiWarningRecord.getStatus();
@@ -529,7 +527,7 @@ public class RyTask
             /*String userId = SecurityUtils.getUserId().toString();
             /*String userId = SecurityUtils.getUserId().toString();
             String username = SecurityUtils.getUsername();*/
             String username = SecurityUtils.getUsername();*/
         chatReq.setUserId(WARNING_DEFAULT_CREATE);
         chatReq.setUserId(WARNING_DEFAULT_CREATE);
-        String showVal = this.buildShowValue(tXinyiWarningRecord, tXinyiIndustry, normConfig);
+        String showVal = this.buildShowValueYJ(tXinyiWarningRecord, tXinyiIndustry, normConfig);
         chatReq.setShowVal(showVal);//前端展示的数据和提问的数据不一致
         chatReq.setShowVal(showVal);//前端展示的数据和提问的数据不一致
         chatReq.setQuestion(WARNING_DEFAULT_QUESTION);//本地问题
         chatReq.setQuestion(WARNING_DEFAULT_QUESTION);//本地问题
         chatReq.setAnswer(tXinyiWarningRecord.getReason() + ",请检查设备是否正常运行");
         chatReq.setAnswer(tXinyiWarningRecord.getReason() + ",请检查设备是否正常运行");

+ 1 - 1
slibra-system/src/main/java/com/slibra/business/res/ShowValueBasic.java → slibra-system/src/main/java/com/slibra/business/res/ShowValueCSBasic.java

@@ -13,7 +13,7 @@ import java.math.BigDecimal;
 @Data
 @Data
 @AllArgsConstructor
 @AllArgsConstructor
 @NoArgsConstructor
 @NoArgsConstructor
-public class ShowValueBasic {
+public class ShowValueCSBasic {
 
 
 
 
     /*@JSONField(ordinal = 1, name = "title")
     /*@JSONField(ordinal = 1, name = "title")

+ 47 - 0
slibra-system/src/main/java/com/slibra/business/res/ShowValueJSBasic.java

@@ -0,0 +1,47 @@
+package com.slibra.business.res;
+
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+@Builder
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ShowValueJSBasic {
+
+
+    /*@JSONField(ordinal = 1, name = "title")
+    private String a;*/
+
+    @JSONField(ordinal = 2, name = "报警时间")
+    private String b;
+
+    @JSONField(ordinal = 3, name = "报警值")
+    private BigDecimal c;
+
+    /*@JSONField(ordinal = 4, name = "管控值")
+    private BigDecimal d;*/
+
+    @JSONField(ordinal = 5, name = "设计值")
+    private BigDecimal e;
+
+    @JSONField(ordinal = 6, name = "报警级别")
+    private String f;
+
+    @JSONField(ordinal = 7, name = "报警次数")
+    private int g;
+
+    @JSONField(ordinal = 8, name = "数据来源")
+    private String h;
+
+    @JSONField(ordinal = 9, name = "状态")
+    private String i;
+
+
+}