Răsfoiți Sursa

报警列表的数值都保留两位小时

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

+ 20 - 3
slibra-admin/src/main/java/com/slibra/web/controller/business/FrontController.java

@@ -179,7 +179,7 @@ public class FrontController extends BaseController {
         log.info("进入了 报警+预警记录列表分页 接口");
         startPage();
         List<TXinyiWarningRecord> tXinyiWarningRecords = xinyiWarningRecordMapper.selectTXinyiWarningRecordList(tXinyiWarningRecord);
-        this.handleWarningCounts(tXinyiWarningRecords);
+        this.addWarningRecordExtra(tXinyiWarningRecords);
         return getDataTable(tXinyiWarningRecords);
     }
 
@@ -196,12 +196,12 @@ public class FrontController extends BaseController {
     {
         log.info("进入了 报警+预警记录列表不分页 接口");
         List<TXinyiWarningRecord> tXinyiWarningRecords = xinyiWarningRecordMapper.selectTXinyiWarningRecordList(tXinyiWarningRecord);
-        this.handleWarningCounts(tXinyiWarningRecords);
+        this.addWarningRecordExtra(tXinyiWarningRecords);
         return AjaxResult.success(tXinyiWarningRecords);
     }
 
 
-    private void handleWarningCounts(List<TXinyiWarningRecord> tXinyiWarningRecords) {
+    private void addWarningRecordExtra(List<TXinyiWarningRecord> tXinyiWarningRecords) {
         if(!CollectionUtils.isEmpty(tXinyiWarningRecords)){
             for (TXinyiWarningRecord tXinyiWarningRecord : tXinyiWarningRecords) {
                 Date endDate = null;
@@ -220,10 +220,27 @@ public class FrontController extends BaseController {
                 //2024年7月11日13:36:41 新增处理,返回带单位的报警值(目前只处理生化报警的)
                 if(1 == tXinyiWarningRecord.getType())
                     tXinyiWarningRecord.setWarningValStr(this.getWarningValStr(tXinyiWarningRecord.getWarningVal(), tXinyiWarningRecord.getCategory()));
+                //2024年7月13日17:41:06 小数点保留两位小数
+                this.handleDecimalPoint(tXinyiWarningRecord);
             }
         }
     }
 
+    private void handleDecimalPoint(TXinyiWarningRecord xinyiWarningRecord) {
+        BigDecimal warningVal = xinyiWarningRecord.getWarningVal();
+        BigDecimal designVal = xinyiWarningRecord.getDesignVal();
+        BigDecimal controlVal = xinyiWarningRecord.getControlVal();
+        BigDecimal forecastVal = xinyiWarningRecord.getForecastVal();
+        if(!Objects.isNull(warningVal))
+            xinyiWarningRecord.setWarningVal(DecimalUtils.getAbsAndScale(warningVal, INT_2));
+        if(!Objects.isNull(designVal))
+            xinyiWarningRecord.setDesignVal(DecimalUtils.getAbsAndScale(designVal, INT_2));
+        if(!Objects.isNull(controlVal))
+            xinyiWarningRecord.setControlVal(DecimalUtils.getAbsAndScale(controlVal, INT_2));
+        if(!Objects.isNull(forecastVal))
+            xinyiWarningRecord.setForecastVal(DecimalUtils.getAbsAndScale(forecastVal, INT_2));
+    }
+
     private String getWarningValStr(BigDecimal warningVal, String category) {
         BigDecimal absAndScale = DecimalUtils.getAbsAndScale(warningVal, MyConstants.INT_2);
         if(BusinessEnum.WarningCategoryEnum.NHLB.getCode().equals(category))