zxl
2025-03-03 eb0e29e72049bc65f943cc864929c332b07f25d0
ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
@@ -67,6 +67,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -1419,13 +1420,13 @@
    private void setLoseDaily(VideoDailyExp videoDailyExp, List<RecordMetaDSumResult> recordResults) throws NoSuchFieldException, IllegalAccessException {
        //一个设备当月在线情况
        for (RecordMetaDSumResult recordResult : recordResults) {
            int dayOfMonth = DateUtils.getDayOfMonth(recordResult.getStatTime());
            int dayOfMonth = DateUtils.getDayOfMonth(recordResult.getStatTime());  //获取启动日期是当月第几天
            //反射赋值,字段统一定义为day+1,2,3...
            Field field = videoDailyExp.getClass().getDeclaredField("day" + dayOfMonth);
            field.setAccessible(true);
            //防止转换为科学计数法
            BigDecimal bigDecimal = BigDecimal.valueOf(recordResult.getMissDuration() == null ? 0 : recordResult.getMissDuration());
            field.set(videoDailyExp, bigDecimal.toString());
            BigDecimal bigDecimal = BigDecimal.valueOf(recordResult.getMissDuration() == null ? 0 : (recordResult.getMissDuration()) * 60);
            field.set(videoDailyExp, bigDecimal.setScale(2, RoundingMode.HALF_UP).toString());
        }
    }
}