瀏覽代碼

放入对应的常量配置 逻辑优化

wangmiaomiao 11 月之前
父節點
當前提交
b3b95e6b20

+ 10 - 14
slibra-admin/src/main/java/com/slibra/web/controller/business/WarningController.java

@@ -11,6 +11,7 @@ import com.slibra.business.mapper.TXinyiNormConfigMapper;
 import com.slibra.business.mapper.TXinyiRobotMapper;
 import com.slibra.business.mapper.TXinyiRobotMapper;
 import com.slibra.business.service.ITXinyiNormConfigService;
 import com.slibra.business.service.ITXinyiNormConfigService;
 import com.slibra.business.service.impl.TXinyiNormConfigServiceImpl;
 import com.slibra.business.service.impl.TXinyiNormConfigServiceImpl;
+import com.slibra.common.constant.MyConstants;
 import com.slibra.common.core.controller.BaseController;
 import com.slibra.common.core.controller.BaseController;
 import com.slibra.common.core.domain.AjaxResult;
 import com.slibra.common.core.domain.AjaxResult;
 import com.slibra.common.utils.DateUtils;
 import com.slibra.common.utils.DateUtils;
@@ -91,8 +92,7 @@ public class WarningController extends BaseController {
             BigDecimal jsTp = tXinyiIndustry.getJsTp();
             BigDecimal jsTp = tXinyiIndustry.getJsTp();
             BigDecimal jszlSjz = normConfig.getJszlSjz();
             BigDecimal jszlSjz = normConfig.getJszlSjz();
             if(!Objects.isNull(jsTp) && !Objects.isNull(jszlSjz)){
             if(!Objects.isNull(jsTp) && !Objects.isNull(jszlSjz)){
-                //todo 写到枚举中
-                BigDecimal jszlSjzMax = jszlSjz.multiply(new BigDecimal("1.1"));
+                BigDecimal jszlSjzMax = jszlSjz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
                 if(jsTp.compareTo(jszlSjz) > 0 && jsTp.compareTo(jszlSjzMax) <= 0)
                 if(jsTp.compareTo(jszlSjz) > 0 && jsTp.compareTo(jszlSjzMax) <= 0)
                     System.out.println("进水总磷超标报警级别为 二级");
                     System.out.println("进水总磷超标报警级别为 二级");
                 else if (jsTp.compareTo(jszlSjzMax) > 0)
                 else if (jsTp.compareTo(jszlSjzMax) > 0)
@@ -119,8 +119,7 @@ public class WarningController extends BaseController {
             BigDecimal jsCod = tXinyiIndustry.getJsCod();
             BigDecimal jsCod = tXinyiIndustry.getJsCod();
             BigDecimal jscodSjz = normConfig.getJscodSjz();
             BigDecimal jscodSjz = normConfig.getJscodSjz();
             if(!Objects.isNull(jsCod) && !Objects.isNull(jscodSjz)){
             if(!Objects.isNull(jsCod) && !Objects.isNull(jscodSjz)){
-                //todo 写到枚举中
-                BigDecimal jscodMax = jscodSjz.multiply(new BigDecimal("1.1"));
+                BigDecimal jscodMax = jscodSjz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
                 if(jsCod.compareTo(jscodSjz) > 0 && jsCod.compareTo(jscodMax) <= 0)
                 if(jsCod.compareTo(jscodSjz) > 0 && jsCod.compareTo(jscodMax) <= 0)
                     System.out.println("进水COD超标报警级别为 二级");
                     System.out.println("进水COD超标报警级别为 二级");
                 else if (jsCod.compareTo(jscodMax) > 0)
                 else if (jsCod.compareTo(jscodMax) > 0)
@@ -147,8 +146,7 @@ public class WarningController extends BaseController {
             BigDecimal jsTn = tXinyiIndustry.getJsTn();
             BigDecimal jsTn = tXinyiIndustry.getJsTn();
             BigDecimal jszdSjz = normConfig.getJszdSjz();
             BigDecimal jszdSjz = normConfig.getJszdSjz();
             if(!Objects.isNull(jsTn) && !Objects.isNull(jszdSjz)){
             if(!Objects.isNull(jsTn) && !Objects.isNull(jszdSjz)){
-                //todo 写到枚举中
-                BigDecimal jszdMax = jszdSjz.multiply(new BigDecimal("1.1"));
+                BigDecimal jszdMax = jszdSjz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
                 if(jsTn.compareTo(jszdSjz) > 0 && jsTn.compareTo(jszdMax) <= 0)
                 if(jsTn.compareTo(jszdSjz) > 0 && jsTn.compareTo(jszdMax) <= 0)
                     System.out.println("进水总氮超标报警级别为 二级");
                     System.out.println("进水总氮超标报警级别为 二级");
                 else if (jsTn.compareTo(jszdMax) > 0)
                 else if (jsTn.compareTo(jszdMax) > 0)
@@ -174,8 +172,7 @@ public class WarningController extends BaseController {
             BigDecimal jsNh3 = tXinyiIndustry.getJsNh3();
             BigDecimal jsNh3 = tXinyiIndustry.getJsNh3();
             BigDecimal jsadSjz = normConfig.getJsadSjz();
             BigDecimal jsadSjz = normConfig.getJsadSjz();
             if(!Objects.isNull(jsNh3) && !Objects.isNull(jsadSjz)){
             if(!Objects.isNull(jsNh3) && !Objects.isNull(jsadSjz)){
-                //todo 写到枚举中
-                BigDecimal jsadMax = jsadSjz.multiply(new BigDecimal("1.1"));
+                BigDecimal jsadMax = jsadSjz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
                 if(jsNh3.compareTo(jsadSjz) > 0 && jsNh3.compareTo(jsadMax) <= 0)
                 if(jsNh3.compareTo(jsadSjz) > 0 && jsNh3.compareTo(jsadMax) <= 0)
                     System.out.println("进水氨氮超标报警级别为 二级");
                     System.out.println("进水氨氮超标报警级别为 二级");
                 else if (jsNh3.compareTo(jsadMax) > 0)
                 else if (jsNh3.compareTo(jsadMax) > 0)
@@ -201,8 +198,7 @@ public class WarningController extends BaseController {
             BigDecimal jsSS = tXinyiIndustry.getJsSs();
             BigDecimal jsSS = tXinyiIndustry.getJsSs();
             BigDecimal jsSSSjz = normConfig.getJsssSjz();
             BigDecimal jsSSSjz = normConfig.getJsssSjz();
             if(!Objects.isNull(jsSS) && !Objects.isNull(jsSSSjz)){
             if(!Objects.isNull(jsSS) && !Objects.isNull(jsSSSjz)){
-                //todo 写到枚举中
-                BigDecimal jsssMax = jsSSSjz.multiply(new BigDecimal("1.1"));
+                BigDecimal jsssMax = jsSSSjz.multiply(new BigDecimal(MyConstants.SCALE_VALUE));
                 if(jsSS.compareTo(jsSSSjz) > 0 && jsSS.compareTo(jsssMax) <= 0)
                 if(jsSS.compareTo(jsSSSjz) > 0 && jsSS.compareTo(jsssMax) <= 0)
                     System.out.println("进水SS超标报警级别为 二级");
                     System.out.println("进水SS超标报警级别为 二级");
                 else if (jsSS.compareTo(jsssMax) > 0)
                 else if (jsSS.compareTo(jsssMax) > 0)
@@ -382,9 +378,8 @@ public class WarningController extends BaseController {
             BigDecimal djwnndXxz = normConfig.getDjwnndXxz();
             BigDecimal djwnndXxz = normConfig.getDjwnndXxz();
             BigDecimal djwnndSxz = normConfig.getDjwnndSxz();
             BigDecimal djwnndSxz = normConfig.getDjwnndSxz();
             if(!Objects.isNull(jsSw)){
             if(!Objects.isNull(jsSw)){
-                //todo 配置到常量池中
                 //一池
                 //一池
-                if(jsSw.compareTo(new BigDecimal("12")) > 0){//按夏季计算
+                if(jsSw.compareTo(new BigDecimal(MyConstants.TEMPERATURE_VALUE)) > 0){//按夏季计算
                     if(!Objects.isNull(xjwnndXxz)){
                     if(!Objects.isNull(xjwnndXxz)){
                         if(!Objects.isNull(shcHyOneMlss) && shcHyOneMlss.compareTo(xjwnndXxz) < 0)
                         if(!Objects.isNull(shcHyOneMlss) && shcHyOneMlss.compareTo(xjwnndXxz) < 0)
                             System.out.println("污泥浓度(一池)报警级别为 一级");
                             System.out.println("污泥浓度(一池)报警级别为 一级");
@@ -621,8 +616,9 @@ public class WarningController extends BaseController {
                 if(divide.compareTo(eccglfhnkzSxz) > 0)
                 if(divide.compareTo(eccglfhnkzSxz) > 0)
                     System.out.println("二沉池固体负荷报警别为 一级");
                     System.out.println("二沉池固体负荷报警别为 一级");
                 BigDecimal eccgtfhSjz = normConfig.getEccgtfhSjz();
                 BigDecimal eccgtfhSjz = normConfig.getEccgtfhSjz();
-                //todo 这里的eccglfhnkzSxz要改成下限值 并且新增字段
-                if(!Objects.isNull(eccgtfhSjz) && divide.compareTo(eccgtfhSjz) > 0 && divide.compareTo(eccglfhnkzSxz) <= 0)
+                BigDecimal eccgtfhnkxxz = normConfig.getECCGTFHNKXXZ();
+                // 这里的eccglfhnkzSxz要改成下限值 并且新增字段
+                if(!Objects.isNull(eccgtfhSjz) && !Objects.isNull(eccgtfhnkxxz) && divide.compareTo(eccgtfhSjz) > 0 && divide.compareTo(eccgtfhnkxxz) <= 0)
                     System.out.println("二沉池固体负荷报警别为 二级");
                     System.out.println("二沉池固体负荷报警别为 二级");
                 System.out.println("二沉池固体负荷报警级别为数据正常~~~");
                 System.out.println("二沉池固体负荷报警级别为数据正常~~~");
                 System.out.println("--------------30");
                 System.out.println("--------------30");

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

@@ -3,4 +3,10 @@ package com.slibra.common.constant;
 public class MyConstants {
 public class MyConstants {
 
 
     public static final String QI_NIU_YUN_UPLOAD_URL = "userupload/";
     public static final String QI_NIU_YUN_UPLOAD_URL = "userupload/";
+
+    //报警计算使用的比例  默认是1.1倍
+    public static final String SCALE_VALUE = "1.1";
+
+    //温度的范围  超过该温度表示夏季;没有超过表示冬季
+    public static final String TEMPERATURE_VALUE = "12";
 }
 }