Browse Source

报警计算调整

wangmiaomiao 11 months ago
parent
commit
08032f670d

+ 12 - 6
slibra-admin/src/main/java/com/slibra/web/controller/business/WarningController.java

@@ -75,9 +75,9 @@ public class WarningController extends BaseController {
         Date currentDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
         //获取对个格式日期字符串
         String currentDateStr = DateUtil.format(currentDate, DateUtils.YYYYMMDD_TS);
-        currentDateStr = "2024/03/01";
+        currentDateStr = "2023/02/21";
         String currentHourStr = DateUtil.format(currentDate, DateUtils.YYYYMMDDHH_TS);
-        currentHourStr = "2024/05/05 11";
+        currentHourStr = "2024/05/07 09";
         //查询工业库 日报库 机器人化验库
         List<TXinyiDaily> tXinyiDailies = this.dailyMapper.selectTXinyiDailyList(TXinyiDaily.builder().testDate(currentDateStr).build());
         List<TXinyiIndustry> tXinyiIndustries = this.industryMapper.selectTXinyiIndustryList(TXinyiIndustry.builder().testHour(currentHourStr).build());
@@ -239,6 +239,7 @@ public class WarningController extends BaseController {
                 System.out.println("--------------11");
             }
             //12 厌氧区停留时间
+            //todo 用工业路,不用日报,日报数据不对,工业库计算
             BigDecimal yyHrt = tXinyiDaily.getYyHrt();
             BigDecimal yyytlsjGkz = normConfig.getYyqtlsjGkz();
             if(!Objects.isNull(yyHrt) && !Objects.isNull(yyytlsjGkz)){
@@ -590,6 +591,7 @@ public class WarningController extends BaseController {
             }
 
 
+            //todo 放到工业库
             //下面的有疑问  R是计算出来的   单位怎么算
             //29 二沉池表面负荷报警 二沉池表面负荷=[e]=[Q_in]/([n_er]*[A_er])m³/(m²·h)
             BigDecimal eccsl = normConfig.getECCSL();
@@ -597,7 +599,7 @@ public class WarningController extends BaseController {
             BigDecimal eccbmfhznkzSxz = normConfig.getEccbmfhznkzSxz();
             if(!Objects.isNull(eccbmfhznkzSxz) && !Objects.isNull(jsl) && !Objects.isNull(eccsl) && !Objects.isNull(eccsjzzj)){
                 BigDecimal eccArea = new BigDecimal(Math.PI).multiply(eccsjzzj).multiply(eccsjzzj).divide(new BigDecimal("4"), 4, RoundingMode.HALF_UP);
-                BigDecimal multiply = jsl.divide(eccsl, 4, RoundingMode.HALF_UP).multiply(eccArea);
+                BigDecimal multiply = jsl.divide(eccsl, 4, RoundingMode.HALF_UP).divide(new BigDecimal("24").multiply(eccArea), 4, RoundingMode.HALF_UP);
                 if(multiply.compareTo(eccbmfhznkzSxz) > 0)
                     System.out.println("二沉池表面负荷报警别为 一级");
                 System.out.println("二沉池表面负荷报警级别为数据正常~~~");
@@ -613,10 +615,12 @@ public class WarningController extends BaseController {
                 && !Objects.isNull(shcHyOneMlss) && !Objects.isNull(shcHyTwoMlss) && !Objects.isNull(eccsl) && !Objects.isNull(eccsjzzj)){
                 BigDecimal avgMlss = shcHyOneMlss.add(shcHyTwoMlss).divide(new BigDecimal("2"), 4, RoundingMode.HALF_UP);
                 BigDecimal eccArea = new BigDecimal(Math.PI).multiply(eccsjzzj).multiply(eccsjzzj).divide(new BigDecimal("4"), 4, RoundingMode.HALF_UP);
-                BigDecimal divide = whlR.add(new BigDecimal("1")).multiply(jsl).multiply(new BigDecimal("24")).multiply(avgMlss).divide(eccsl, 4, RoundingMode.HALF_UP).divide(eccArea, 4, RoundingMode.HALF_UP).divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
+                //如果是日报 乘以1  如果是工业库,乘以24  外回流R 是百分数,要再除以100
+                BigDecimal divide = (whlR.divide(new BigDecimal("100"), 4, RoundingMode.HALF_UP).add(new BigDecimal("1"))).multiply(jsl).multiply(new BigDecimal("1")).multiply(avgMlss).divide(eccsl, 4, RoundingMode.HALF_UP).divide(eccArea, 4, RoundingMode.HALF_UP).divide(new BigDecimal("1000"), 4, RoundingMode.HALF_UP);
                 if(divide.compareTo(eccglfhnkzSxz) > 0)
                     System.out.println("二沉池固体负荷报警别为 一级");
                 BigDecimal eccgtfhSjz = normConfig.getEccgtfhSjz();
+                //todo 这里的eccglfhnkzSxz要改成下限值 并且新增字段
                 if(!Objects.isNull(eccgtfhSjz) && divide.compareTo(eccgtfhSjz) > 0 && divide.compareTo(eccglfhnkzSxz) <= 0)
                     System.out.println("二沉池固体负荷报警别为 二级");
                 System.out.println("二沉池固体负荷报警级别为数据正常~~~");
@@ -629,7 +633,8 @@ public class WarningController extends BaseController {
             BigDecimal fclbsl = normConfig.getFCLBSL();
             BigDecimal fcxbgzxl = normConfig.getFCXBGZXL();
             if(!Objects.isNull(jsl) && !Objects.isNull(fcxbsjll) && !Objects.isNull(fclbsl) && !Objects.isNull(fcxbgzxl)){
-                BigDecimal divide = fcxbsjll.multiply(fclbsl).multiply(fcxbgzxl).divide(jsl, 4, RoundingMode.HALF_UP);
+                //如果是日报 乘以24, 工业库乘以1   乘以100是·单位是百分之多少
+                BigDecimal divide = fcxbsjll.multiply(fclbsl).multiply(fcxbgzxl).divide(jsl, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("24").multiply(new BigDecimal("100")));
                 BigDecimal fcxslblsjzXxz = normConfig.getFcxslblsjzXxz();
                 if(!Objects.isNull(fcxslblsjzXxz) && divide.compareTo(fcxslblsjzXxz) < 0)
                     System.out.println("深度处理反冲洗水量比例报警别为 一级");
@@ -646,7 +651,8 @@ public class WarningController extends BaseController {
             BigDecimal hxslcglmj = normConfig.getHXSLCGLMJ();
             BigDecimal sdclfzglsdSjz = normConfig.getSdclfzglsdSjz();
             if(!Objects.isNull(hxslcsl) && !Objects.isNull(hxslcglmj) && !Objects.isNull(jsl) && !Objects.isNull(sdclfzglsdSjz)){
-                BigDecimal divide = jsl.divide(hxslcsl, 4, RoundingMode.HALF_UP).divide(hxslcglmj, 4, RoundingMode.HALF_UP);
+                //除以24是单位转换
+                BigDecimal divide = jsl.divide(hxslcsl, 4, RoundingMode.HALF_UP).divide(hxslcglmj, 4, RoundingMode.HALF_UP).divide(new BigDecimal("24"), 4, RoundingMode.HALF_UP);
                 if(divide.compareTo(sdclfzglsdSjz) >0 )
                     System.out.println("深度处理峰值过滤速度报警别为 一级");
                 System.out.println("深度处理峰值过滤速度报警级别为数据正常~~~");