Browse Source

1.计算超污染物限制和负荷根据具体指标计算 2.化验室的报警功能完善 3.返回给前端的报警明细内容调整

王苗苗 1 month ago
parent
commit
345ddf9b9f

+ 9 - 0
slibra-common/src/main/java/com/slibra/common/enums/BusinessEnum.java

@@ -452,6 +452,15 @@ public class BusinessEnum {
         {
             return msg;
         }
+
+        public static String getMsgByCode(int code) {
+            for (WarningSymbolEnum status : WarningSymbolEnum.values()) {
+                if (status.getCode() == code) {
+                    return status.getMsg();
+                }
+            }
+            return "Unknown code";
+        }
     }
 
 

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

@@ -1325,11 +1325,14 @@ public class AsyncTask {
     public void handleSZWarning(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
         //出水相关
         //出水COD报警
+        //2025年02月14日10:22:05 计算出相应的超污染物限制 和 超污染物负荷值,然后传到下一个方法,否则下一个方法很多判断
         BigDecimal csCod = tXinyiIndustry.getCsCod();
         BigDecimal cscodBzz = normConfig.getCscodBzz();
         BigDecimal cscodGkz = normConfig.getCscodGkz();
+        BigDecimal jsSlq = tXinyiIndustry.getJsSlq();
+        BigDecimal jsslSjz = normConfig.getJsslSjz();
         if(!Objects.isNull(cscodBzz)){
-            handleXinYiWarningsCs(cscodBzz, csCod, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_COD.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningsCs(cscodBzz, csCod, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_COD.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsCod(), jsslSjz, normConfig.getJscodSjz()));
         }
 
         //出水总磷超标报警
@@ -1337,7 +1340,7 @@ public class AsyncTask {
         BigDecimal cszlBzz = normConfig.getCszlBzz();
         BigDecimal cszlGkz = normConfig.getCszlGkz();
         if(!Objects.isNull(cszlBzz)){
-            handleXinYiWarningsCs(cszlBzz, csTp, cszlGkz, BusinessEnum.WarningCategoryEnum.CS_ZL.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningsCs(cszlBzz, csTp, cszlGkz, BusinessEnum.WarningCategoryEnum.CS_ZL.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsTp(), jsslSjz, normConfig.getJszlSjz()));
         }
 
 
@@ -1346,7 +1349,7 @@ public class AsyncTask {
         BigDecimal cszzBzz = normConfig.getCszzBzz();
         BigDecimal cszzGkz = normConfig.getCszzGkz();
         if(!Objects.isNull(cszzBzz)){
-            handleXinYiWarningsCs(cszzBzz, csTn, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_ZD.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningsCs(cszzBzz, csTn, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_ZD.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsTn(), jsslSjz, normConfig.getJszdSjz()));
         }
 
         //出水氨氮超标报警
@@ -1354,7 +1357,7 @@ public class AsyncTask {
         BigDecimal csadBzz = normConfig.getCsadBzz();
         BigDecimal csadGkz = normConfig.getCsadGkz();
         if(!Objects.isNull(csadBzz)){
-            handleXinYiWarningsCs(csadBzz, csNh3, csadGkz, BusinessEnum.WarningCategoryEnum.CS_AD.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningsCs(csadBzz, csNh3, csadGkz, BusinessEnum.WarningCategoryEnum.CS_AD.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsNh3(), jsslSjz, normConfig.getJsadSjz()));
         }
 
         //出水SS超标报警
@@ -1362,7 +1365,7 @@ public class AsyncTask {
         BigDecimal csSSBzz = normConfig.getCsssBzz();
         BigDecimal csssGkz = normConfig.getCsssGkz();
         if(!Objects.isNull(csSSBzz)){
-            handleXinYiWarningsCs(csSSBzz, csSS, csssGkz, BusinessEnum.WarningCategoryEnum.CS_SS.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningsCs(csSSBzz, csSS, csssGkz, BusinessEnum.WarningCategoryEnum.CS_SS.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsSs(), jsslSjz, normConfig.getJsssSjz()));
         }
 
         //进水相关报警
@@ -1370,35 +1373,35 @@ public class AsyncTask {
         BigDecimal jsTp = tXinyiIndustry.getJsTp();
         BigDecimal jszlSjz = normConfig.getJszlSjz();
         if(!Objects.isNull(jszlSjz)){
-            handleXinYiWarningRecordJS(jszlSjz, jsTp, BusinessEnum.WarningCategoryEnum.JS_ZL.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningRecordJS(jszlSjz, jsTp, BusinessEnum.WarningCategoryEnum.JS_ZL.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsTp(), jsslSjz, normConfig.getJszlSjz()));
         }
 
         //进水COD超标报警
         BigDecimal jsCod = tXinyiIndustry.getJsCod();
         BigDecimal jscodSjz = normConfig.getJscodSjz();
         if(!Objects.isNull(jscodSjz)){
-            handleXinYiWarningRecordJS(jscodSjz, jsCod, BusinessEnum.WarningCategoryEnum.JS_COD.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningRecordJS(jscodSjz, jsCod, BusinessEnum.WarningCategoryEnum.JS_COD.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsCod(), jsslSjz, normConfig.getJscodSjz()));
         }
 
         //进水总氮超标报警
         BigDecimal jsTn = tXinyiIndustry.getJsTn();
         BigDecimal jszdSjz = normConfig.getJszdSjz();
         if(!Objects.isNull(jszdSjz)){
-            handleXinYiWarningRecordJS(jszdSjz, jsTn, BusinessEnum.WarningCategoryEnum.JS_ZD.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningRecordJS(jszdSjz, jsTn, BusinessEnum.WarningCategoryEnum.JS_ZD.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsTn(), jsslSjz, normConfig.getJszdSjz()));
         }
 
         //进水氨氮超标报警
         BigDecimal jsNh3 = tXinyiIndustry.getJsNh3();
         BigDecimal jsadSjz = normConfig.getJsadSjz();
         if(!Objects.isNull(jsadSjz)){
-            handleXinYiWarningRecordJS(jsadSjz, jsNh3, BusinessEnum.WarningCategoryEnum.JS_AD.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningRecordJS(jsadSjz, jsNh3, BusinessEnum.WarningCategoryEnum.JS_AD.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsNh3(), jsslSjz, normConfig.getJsadSjz()));
         }
 
         //进水SS超标报警
         BigDecimal jsSS = tXinyiIndustry.getJsSs();
         BigDecimal jsSSSjz = normConfig.getJsssSjz();
         if(!Objects.isNull(jsSSSjz)){
-            handleXinYiWarningRecordJS(jsSSSjz, jsSS, BusinessEnum.WarningCategoryEnum.JS_SS.getCode(), tXinyiIndustry, normConfig);
+            handleXinYiWarningRecordJS(jsSSSjz, jsSS, BusinessEnum.WarningCategoryEnum.JS_SS.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsSs(), jsslSjz, normConfig.getJsssSjz()));
         }
     }
 
@@ -1729,7 +1732,8 @@ public class AsyncTask {
             showValueSHBasic.setF(tXinyiWarningRecord.getLevel());
         }*/
         //生化报警固定了
-        showValueSHBasic.setF(tXinyiWarningRecord.getLevel());
+//        showValueSHBasic.setF(tXinyiWarningRecord.getLevel());
+        showValueSHBasic.setF(tXinyiWarningRecord.getSymbolDesc());
         showValueSHBasic.setH("计算");
 
         //通用的
@@ -1783,7 +1787,8 @@ public class AsyncTask {
             ShowValueCSBasic showValueCSBasic = new ShowValueCSBasic();
             if(ZERO_SZ_WARNING.getCode().equals(remark)){//水质报警
                 showValueCSBasic.setH(ZAIXIANYIBIAO);
-                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
+//                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
+                showValueCSBasic.setF(tXinyiWarningRecord.getSymbolDesc());
             }else if(ONE_SH_WARNING.getCode().equals(remark)){//生化报警
                 showValueCSBasic.setH(ZAIXIANYIBIAO);
             }else if(BusinessEnum.BigModelWarningTypeRemarkEnum.TWO_YC_WARNING.getCode().equals(remark)){//预测报警
@@ -1791,7 +1796,8 @@ public class AsyncTask {
 //                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
             }else {//机器人化验室报警(特殊的水质报警)
                 showValueCSBasic.setH(LIANXUJIANCE);
-                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
+//                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
+                showValueCSBasic.setF(tXinyiWarningRecord.getSymbolDesc());
             }
             //通用的
             //        showValueBasic.setA(tXinyiWarningRecord.getReason());
@@ -1810,7 +1816,8 @@ public class AsyncTask {
             ShowValueJSBasic showValueJSBasic = new ShowValueJSBasic();
             if(ZERO_SZ_WARNING.getCode().equals(remark)){//水质报警
                 showValueJSBasic.setH(ZAIXIANYIBIAO);
-                showValueJSBasic.setF(tXinyiWarningRecord.getLevel());
+//                showValueJSBasic.setF(tXinyiWarningRecord.getLevel());
+                showValueJSBasic.setF(tXinyiWarningRecord.getSymbolDesc());
             }else if(ONE_SH_WARNING.getCode().equals(remark)){//生化报警
                 showValueJSBasic.setH(ZAIXIANYIBIAO);
             }else if(BusinessEnum.BigModelWarningTypeRemarkEnum.TWO_YC_WARNING.getCode().equals(remark)){//预测报警
@@ -1818,7 +1825,8 @@ public class AsyncTask {
 //                showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
             }else {//机器人化验室报警(特殊的 水质报警)
                 showValueJSBasic.setH(LIANXUJIANCE);
-                showValueJSBasic.setF(tXinyiWarningRecord.getLevel());
+//                showValueJSBasic.setF(tXinyiWarningRecord.getLevel());
+                showValueJSBasic.setF(tXinyiWarningRecord.getSymbolDesc());
             }
             //通用的
             //        showValueBasic.setA(tXinyiWarningRecord.getReason());
@@ -1920,9 +1928,10 @@ public class AsyncTask {
      * @param category
      * @param tXinyiIndustry
      * @param normConfig
+     * @param cwrwfhz
      * @return
      */
-    private void handleXinYiWarningsCs(BigDecimal csBzz, BigDecimal currentVal, BigDecimal csGkz, String category, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+    private void handleXinYiWarningsCs(BigDecimal csBzz, BigDecimal currentVal, BigDecimal csGkz, String category, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, BigDecimal cwrwfhz) {
         BigDecimal multiply = csBzz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
         TXinyiWarningRecord tXinyiWarningRecord = new TXinyiWarningRecord();
         /*String category = BusinessEnum.WarningCategoryEnum.CS_AD.getCode();*/
@@ -1940,10 +1949,7 @@ public class AsyncTask {
         tXinyiWarningRecord.setWaterType(BusinessEnum.WaterTypeEnum.CS.getCode());
         //超污染物限制:计算公式为:当前氨氮/氨氮设计值 或者 当前氨氮/氨氮管控值(智能工单使用)  这里是出水的 【需要根据超标还是超管控,具体计算】
         //超污染物负荷值:计算公式为:当前水量与氨氮乘积  /  设计水量与设计进水氨氮的乘积(智能工单使用)
-        tXinyiWarningRecord.setCwrwfhz(this.getCwrwfhz(tXinyiIndustry, normConfig));
-        BigDecimal csNh3 = tXinyiIndustry.getCsNh3();
-        BigDecimal csadBzz = normConfig.getCsadBzz();
-        BigDecimal csadGkz = normConfig.getCsadGkz();
+        tXinyiWarningRecord.setCwrwfhz(cwrwfhz);//2025年02月14日10:42:53 具体指标具体计算,由上游传过来。
 
         //2024年5月25日17:52:33  如果工业库获取不到数据,也触发报警,但是不调用决策接口
         if(Objects.isNull(currentVal) || currentVal.compareTo(BigDecimal.ZERO) == 0){
@@ -1953,17 +1959,17 @@ public class AsyncTask {
             tXinyiWarningRecord.setReason(category + CHAOBIAO_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_ONE);
             tXinyiWarningRecord.setSymbol(BusinessEnum.WarningSymbolEnum.CBZZ.getCode());
-            tXinyiWarningRecord.setCwrwxz(csNh3.divide(csadBzz, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+            tXinyiWarningRecord.setCwrwxz(getCwrwxzByDetail(currentVal, normConfig, category, true));//根据当前值和类型以及是否超标处理
         }else if(currentVal.compareTo(csBzz) >= 0 && currentVal.compareTo(multiply) <= 0){//二级
             tXinyiWarningRecord.setReason(category + CHAOBIAO_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_TWO);
             tXinyiWarningRecord.setSymbol(BusinessEnum.WarningSymbolEnum.CBZZ.getCode());
-            tXinyiWarningRecord.setCwrwxz(csNh3.divide(csadBzz, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+            tXinyiWarningRecord.setCwrwxz(getCwrwxzByDetail(currentVal, normConfig, category, true));//根据当前值和类型以及是否超标处理
         }else if(!Objects.isNull(csGkz) && currentVal.compareTo(csGkz) > 0){
             tXinyiWarningRecord.setReason(category + CHAOGUANKONG_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_THREE);
             tXinyiWarningRecord.setSymbol(BusinessEnum.WarningSymbolEnum.CGKZ.getCode());
-            tXinyiWarningRecord.setCwrwxz(csNh3.divide(csadGkz, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+            tXinyiWarningRecord.setCwrwxz(getCwrwxzByDetail(currentVal, normConfig, category, false));//根据当前值和类型以及是否超标处理
         }else{
             tXinyiWarningRecord = null;//这种的无需处理
         }
@@ -2044,11 +2050,69 @@ public class AsyncTask {
      * @param normConfig
      * @return
      */
+    /*@Deprecated
     private BigDecimal getCwrwfhz(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
         return (tXinyiIndustry.getJsSlq().multiply(tXinyiIndustry.getJsNh3())).divide((normConfig.getJsslSjz().multiply(normConfig.getJsadSjz())), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+    }*/
+
+    /**
+     * 2025年02月14日10:26:03 因为超污染物负荷值 要根据具体的指标计算
+     * @param itemVal
+     * @param jsslSjz
+     * @return
+     */
+    private BigDecimal getCwrwfhzByDetail(BigDecimal jsSlq, BigDecimal itemVal, BigDecimal jsslSjz, BigDecimal itemConfigVal) {
+        return (jsSlq.multiply(itemVal)).divide((jsslSjz.multiply(itemConfigVal)), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+    }
+
+
+    /**
+     * 计算超污染物限制的值: 需要判断进水还是出水;是超标准还是超管控  出水的标准值=进水的设计值
+     * @param currentVal
+     * @param normConfig
+     * @param code
+     * @param isBzz
+     * @return
+     */
+    private BigDecimal getCwrwxzByDetail(BigDecimal currentVal, TXinyiNormConfig normConfig, String code, boolean isBzz) {
+        if(BusinessEnum.WarningCategoryEnum.CS_COD.getCode().equals(code)){
+            if(isBzz)
+                return currentVal.divide(normConfig.getCscodBzz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+            return currentVal.divide(normConfig.getCscodGkz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.CS_ZL.getCode().equals(code) || ROBOT_ECCZLSY.getCode().equals(code)){
+            if(isBzz)
+                return currentVal.divide(normConfig.getCszlBzz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+            return currentVal.divide(normConfig.getCszlGkz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.CS_ZD.getCode().equals(code) || ROBOT_XSY_1.getCode().equals(code) || ROBOT_XSY_2.getCode().equals(code)){
+            if(isBzz)
+                return currentVal.divide(normConfig.getCszzBzz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+            return currentVal.divide(normConfig.getCszzGkz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.CS_AD.getCode().equals(code) || ROBOT_CS_AD.getCode().equals(code)){
+            if(isBzz)
+                return currentVal.divide(normConfig.getCsadBzz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+            return currentVal.divide(normConfig.getCsadGkz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.CS_SS.getCode().equals(code)){
+            if(isBzz)
+                return currentVal.divide(normConfig.getCsssBzz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+            return currentVal.divide(normConfig.getCsssGkz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.JS_ZL.getCode().equals(code)){
+            return currentVal.divide(normConfig.getJszlSjz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.JS_COD.getCode().equals(code)){
+            return currentVal.divide(normConfig.getJscodSjz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.JS_ZD.getCode().equals(code)){
+            return currentVal.divide(normConfig.getJszdSjz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.JS_AD.getCode().equals(code)){
+            return currentVal.divide(normConfig.getJsadSjz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else if(BusinessEnum.WarningCategoryEnum.JS_SS.getCode().equals(code)){
+            return currentVal.divide(normConfig.getJsssSjz(), NUMBER_SCALE_4, RoundingMode.HALF_UP);
+        }else{
+            log.error("暂时不支持的类型,返回null");
+            return null;
+        }
     }
 
 
+
     /**
      * 通过输入的值 生成对应类型的报警对象(进水)
      *
@@ -2057,9 +2121,10 @@ public class AsyncTask {
      * @param category
      * @param tXinyiIndustry
      * @param normConfig
+     * @param cwrwfhz
      * @return
      */
-    private void handleXinYiWarningRecordJS(BigDecimal jsBzz, BigDecimal currentVal, String category, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+    private void handleXinYiWarningRecordJS(BigDecimal jsBzz, BigDecimal currentVal, String category, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, BigDecimal cwrwfhz) {
         BigDecimal multiply = jsBzz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
         TXinyiWarningRecord tXinyiWarningRecord = new TXinyiWarningRecord();
         /*String category = BusinessEnum.WarningCategoryEnum.CS_AD.getCode();*/
@@ -2077,10 +2142,7 @@ public class AsyncTask {
         tXinyiWarningRecord.setWaterType(BusinessEnum.WaterTypeEnum.JS.getCode());
         //超污染物限制:计算公式为:当前氨氮/氨氮设计值 或者 当前氨氮/氨氮管控值(智能工单使用)  这里是出水的 【需要根据超标还是超管控,具体计算】
         //超污染物负荷值:计算公式为:当前水量与氨氮乘积  /  设计水量与设计进水氨氮的乘积(智能工单使用)
-        tXinyiWarningRecord.setCwrwfhz(this.getCwrwfhz(tXinyiIndustry, normConfig));
-        BigDecimal jsNh3 = tXinyiIndustry.getJsNh3();
-        BigDecimal jsadSjz = normConfig.getJsadSjz();
-
+        tXinyiWarningRecord.setCwrwfhz(cwrwfhz);//2025年02月14日10:48:32 具体的值由上游传过来
 
         //2024年5月25日17:52:33  如果工业库获取不到数据,也触发报警,但是不调用决策接口
         if(Objects.isNull(currentVal) || currentVal.compareTo(BigDecimal.ZERO) == 0){
@@ -2090,12 +2152,12 @@ public class AsyncTask {
             tXinyiWarningRecord.setReason(category + CHAOBIAO_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_ONE);
             tXinyiWarningRecord.setSymbol(BusinessEnum.WarningSymbolEnum.CBZZ.getCode());
-            tXinyiWarningRecord.setCwrwxz(jsNh3.divide(jsadSjz, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+            tXinyiWarningRecord.setCwrwxz(getCwrwxzByDetail(currentVal, normConfig, category, true));//根据当前值和类型以及是否超标处理
         }else if(currentVal.compareTo(jsBzz) >= 0 && currentVal.compareTo(multiply) <= 0){//二级
             tXinyiWarningRecord.setReason(category + CHAOBIAO_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_TWO);
             tXinyiWarningRecord.setSymbol(BusinessEnum.WarningSymbolEnum.CBZZ.getCode());
-            tXinyiWarningRecord.setCwrwxz(jsNh3.divide(jsadSjz, NUMBER_SCALE_4, RoundingMode.HALF_UP));
+            tXinyiWarningRecord.setCwrwxz(getCwrwxzByDetail(currentVal, normConfig, category, true));//根据当前值和类型以及是否超标处理
         }else{
             tXinyiWarningRecord = null;//这种的无需处理
         }
@@ -2296,11 +2358,14 @@ public class AsyncTask {
             BigDecimal csadBzz = normConfig.getCsadBzz();
             BigDecimal csadGkz = normConfig.getCsadGkz();
 
+            BigDecimal jsSlq = tXinyiIndustry.getJsSlq();
+            BigDecimal jsslSjz = normConfig.getJsslSjz();
+
             //#1好氧硝酸盐
             BigDecimal no3Hlj1Jqr = tXinyiRobot.getNo3Hlj1Jqr();
             if(!Objects.isNull(no3Hlj1Jqr)){
                 if(!Objects.isNull(cszzBzz)){
-                    handleXinYiWarningsRobot(cszzBzz, no3Hlj1Jqr, cszzGkz, ROBOT_XSY_1.getCode(), tXinyiIndustry, normConfig);
+                    handleXinYiWarningsRobot(cszzBzz, no3Hlj1Jqr, cszzGkz, ROBOT_XSY_1.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsTn(), jsslSjz, normConfig.getJszdSjz()));
                 }
             }
 
@@ -2308,7 +2373,7 @@ public class AsyncTask {
             BigDecimal no3Hlj2Jqr = tXinyiRobot.getNo3Hlj2Jqr();
             if(!Objects.isNull(no3Hlj2Jqr)){
                 if(!Objects.isNull(cszzBzz)){
-                    handleXinYiWarningsRobot(cszzBzz, no3Hlj2Jqr, cszzGkz, ROBOT_XSY_2.getCode(), tXinyiIndustry, normConfig);
+                    handleXinYiWarningsRobot(cszzBzz, no3Hlj2Jqr, cszzGkz, ROBOT_XSY_2.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsTn(), jsslSjz, normConfig.getJszdSjz()));
                 }
             }
 
@@ -2319,7 +2384,7 @@ public class AsyncTask {
                 BigDecimal cszlBzz = normConfig.getCszlBzz();
                 BigDecimal cszlGkz = normConfig.getCszlGkz();
                 if(!Objects.isNull(cszlBzz)){
-                    handleXinYiWarningsRobot(cszlBzz, csTp, cszlGkz, ROBOT_ECCZLSY.getCode(), tXinyiIndustry, normConfig);
+                    handleXinYiWarningsRobot(cszlBzz, csTp, cszlGkz, ROBOT_ECCZLSY.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsTp(), jsslSjz, normConfig.getJszlSjz()));
                 }
             }
 
@@ -2379,7 +2444,7 @@ public class AsyncTask {
             BigDecimal anDan2 = no3Qyc2Jqr.add(nh32Jqr).subtract(no3Hlj2Jqr);
             if(!Objects.isNull(csadBzz)){
                 BigDecimal divide = anDan1.add(anDan2).divide(DECIMAL_2, INT_2, RoundingMode.HALF_UP);
-                handleXinYiWarningsRobot(csadBzz, divide, csadGkz, ROBOT_CS_AD.getCode(), tXinyiIndustry, normConfig);
+                handleXinYiWarningsRobot(csadBzz, divide, csadGkz, ROBOT_CS_AD.getCode(), tXinyiIndustry, normConfig, getCwrwfhzByDetail(jsSlq, tXinyiIndustry.getJsNh3(), jsslSjz, normConfig.getJsadSjz()));
             }
         }
     }
@@ -2396,9 +2461,10 @@ public class AsyncTask {
      * @param category
      * @param tXinyiIndustry
      * @param normConfig
+     * @param cwrwfhz
      * @return
      */
-    private void handleXinYiWarningsRobot(BigDecimal csBzz, BigDecimal currentVal, BigDecimal csGkz, String category, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+    private void handleXinYiWarningsRobot(BigDecimal csBzz, BigDecimal currentVal, BigDecimal csGkz, String category, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, BigDecimal cwrwfhz) {
         BigDecimal multiply = csBzz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
         TXinyiWarningRecord tXinyiWarningRecord = new TXinyiWarningRecord();
         tXinyiWarningRecord.setStatus(0);
@@ -2411,20 +2477,27 @@ public class AsyncTask {
         tXinyiWarningRecord.setCreateBy(WARNING_DEFAULT_CREATE);
         tXinyiWarningRecord.setCreateTime(DateUtils.getNowDate());
         tXinyiWarningRecord.setRemark(THREE_HYS_WARNING.getCode());//化验室
+        tXinyiWarningRecord.setCwrwfhz(cwrwfhz);//2025年02月14日10:42:53 具体指标具体计算,由上游传过来。
 
-        //2024年5月25日17:52:33  如果工业库获取不到数据,也触发报警,但是不调用决策接口
+        //2024年5月25日17:52:33  如果化验室获取不到数据,也触发报警,但是不调用决策接口
         if(Objects.isNull(currentVal)){
             tXinyiWarningRecord.setReason(category + EXCEPTION_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_NO_DATE);
         }else if(currentVal.compareTo(multiply) > 0){//一级
             tXinyiWarningRecord.setReason(category + CHAOBIAO_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_ONE);
+            tXinyiWarningRecord.setSymbol(BusinessEnum.WarningSymbolEnum.CBZZ.getCode());
+            tXinyiWarningRecord.setCwrwxz(getCwrwxzByDetail(currentVal, normConfig, category, true));//根据当前值和类型以及是否超标处理
         }else if(currentVal.compareTo(csBzz) >= 0 && currentVal.compareTo(multiply) <= 0){//二级
             tXinyiWarningRecord.setReason(category + CHAOBIAO_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_TWO);
+            tXinyiWarningRecord.setSymbol(BusinessEnum.WarningSymbolEnum.CBZZ.getCode());
+            tXinyiWarningRecord.setCwrwxz(getCwrwxzByDetail(currentVal, normConfig, category, true));//根据当前值和类型以及是否超标处理
         }else if(!Objects.isNull(csGkz) && currentVal.compareTo(csGkz) > 0){
             tXinyiWarningRecord.setReason(category + CHAOGUANKONG_WARNING);
             tXinyiWarningRecord.setLevel(WARNING_LEVEL_THREE);
+            tXinyiWarningRecord.setSymbol(BusinessEnum.WarningSymbolEnum.CGKZ.getCode());
+            tXinyiWarningRecord.setCwrwxz(getCwrwxzByDetail(currentVal, normConfig, category, false));//根据当前值和类型以及是否超标处理
         }else{
             tXinyiWarningRecord = null;//这种的无需处理
         }

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

@@ -474,7 +474,8 @@ public class RyTask
             basic.put("状态", status == 0 ? "预警中" : "已完成");
         //2024年5月27日14:04:22  额外返回2个字段 [管控值 和 告警级别]  返回的json没有数据是因为value没有值
 //        basic.put("管控值", tXinyiWarningRecord.getControlVal());
-        basic.put("告警级别", tXinyiWarningRecord.getLevel());
+//        basic.put("告警级别", tXinyiWarningRecord.getLevel());
+        basic.put("报警类型", tXinyiWarningRecord.getSymbolDesc());
         result.put("basic", basic);
 
         JSONObject jsData = jsCsFormatData.getJsonObject(tXinyiIndustry, normConfig);//进水数据

+ 14 - 0
slibra-system/src/main/java/com/slibra/business/domain/TXinyiWarningRecord.java

@@ -2,9 +2,11 @@ package com.slibra.business.domain;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.Objects;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.slibra.common.enums.BusinessEnum;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -142,4 +144,16 @@ public class TXinyiWarningRecord extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
     private Date updateTime;
 
+
+    private String symbolDesc;
+
+    public String getSymbolDesc() {
+        if(Objects.isNull(symbol))
+            return null;
+        return BusinessEnum.WarningSymbolEnum.getMsgByCode(symbol);
+    }
+
+    public static void main(String[] args) {
+        System.out.println(BusinessEnum.WarningSymbolEnum.getMsgByCode(1));
+    }
 }

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

@@ -31,7 +31,9 @@ public class ShowValueCSBasic {
     @JSONField(ordinal = 5, name = "标准值")
     private BigDecimal e;
 
-    @JSONField(ordinal = 6, name = "报警级别")
+    /*@JSONField(ordinal = 6, name = "报警级别")
+    private String f;*/
+    @JSONField(ordinal = 6, name = "报警类型")
     private String f;
 
 //    @JSONField(ordinal = 7, name = "报警次数")

+ 3 - 1
slibra-system/src/main/java/com/slibra/business/res/ShowValueJSBasic.java

@@ -31,7 +31,9 @@ public class ShowValueJSBasic {
     @JSONField(ordinal = 5, name = "设计值")
     private BigDecimal e;
 
-    @JSONField(ordinal = 6, name = "报警级别")
+    /*@JSONField(ordinal = 6, name = "报警级别")
+    private String f;*/
+    @JSONField(ordinal = 6, name = "报警类型")
     private String f;
 
 //    @JSONField(ordinal = 7, name = "报警次数")

+ 3 - 1
slibra-system/src/main/java/com/slibra/business/res/ShowValueSHBasic.java

@@ -33,7 +33,9 @@ public class ShowValueSHBasic {
     /*@JSONField(ordinal = 5, name = "设计值")
     private BigDecimal e;*/
 
-    @JSONField(ordinal = 6, name = "报警级别")
+    /*@JSONField(ordinal = 6, name = "报警级别")
+    private String f;*/
+    @JSONField(ordinal = 6, name = "报警类型")
     private String f;
 
 //    @JSONField(ordinal = 7, name = "报警次数")