From 710df8489c740910bda9a557d9a7fdc6cf39df41 Mon Sep 17 00:00:00 2001
From: yangbin <yangbin@qq.com>
Date: 星期四, 20 二月 2025 11:32:55 +0800
Subject: [PATCH] 大屏看板1

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java
index 5f94fd4..adefc97 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java
@@ -1,6 +1,7 @@
 package org.jeecg.modules.mdc.subcontrol.service.impl;
 
 import org.apache.commons.lang.StringUtils;
+import org.checkerframework.checker.units.qual.A;
 import org.jeecg.modules.mdc.entity.EquipmentLog;
 import org.jeecg.modules.mdc.service.*;
 import org.jeecg.modules.mdc.subcontrol.service.MdcBigScreenService;
@@ -34,6 +35,8 @@
     private IEquipmentStatisticalInfoService equipmentStatisticalInfoService;
     @Autowired
     private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService;
+    @Autowired
+    private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService;
 
 
     @Resource
@@ -126,11 +129,17 @@
             List<LastWeekDataVo> lastWeekDataVos = equipmentStatisticalInfoService.findDataRankingForBigScreen(equipmentIdList, monday, saturday);
             if (!lastWeekDataVos.isEmpty()) {
                 for (LastWeekDataVo lastWeekDataVo : lastWeekDataVos) {
-                    Long size = equipmentStatisticalInfoService.selectSize(lastWeekDataVo.getEquipment(), monday, saturday);
-                    lastWeekDataVo.setUtilization(new BigDecimal(String.format("%.2f", (Float.parseFloat(lastWeekDataVo.getProcessingLong()) / (86400 * size) * 100))));
+                    Long size = mdcEquipmentStatisticalInfoService.selectSize(lastWeekDataVo.getEquipment(), monday, saturday);
+                    if (StringUtils.isNotEmpty(lastWeekDataVo.getProcessingLong()) && Float.parseFloat(lastWeekDataVo.getProcessingLong()) >0) {
+                        lastWeekDataVo.setUtilization(new BigDecimal(String.format("%.2f",
+                                (Float.parseFloat(lastWeekDataVo.getProcessingLong()) / (86400 * size) * 100))));
+                    } else {
+                        lastWeekDataVo.setUtilization(new BigDecimal(0));
+                    }
+
                 }
                 List<LastWeekDataVo> collect = lastWeekDataVos.stream().sorted(Comparator.comparing(LastWeekDataVo::getUtilization).reversed()).collect(Collectors.toList());
-                if (collect.size() > 3) {
+                if (collect.size() > 6) {
                     List<LastWeekDataVo> topList = collect.subList(0, 6);
                     for (LastWeekDataVo vo : topList) {
                         LastWeekDataRankingVo rankingVo = new LastWeekDataRankingVo();
@@ -138,6 +147,13 @@
                         rankingVo.setTopRate(vo.getUtilization().toString());
                         voList.add(rankingVo);
                     }
+                } else {
+                    for (LastWeekDataVo vo : collect) {
+                        LastWeekDataRankingVo rankingVo = new LastWeekDataRankingVo();
+                        rankingVo.setTopName(vo.getEquipment());
+                        rankingVo.setTopRate(vo.getUtilization().toString());
+                        voList.add(rankingVo);
+                    }
                 }
 
             }

--
Gitblit v1.9.3