From 218ab860ed4708f6f70a519775c56c9554000fe7 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期五, 27 六月 2025 13:42:41 +0800
Subject: [PATCH] 去除多余引用

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java |   43 ++++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
index 5f89d3e..828202f 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.modules.mdc.entity.*;
 import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMapper;
@@ -75,6 +76,11 @@
         }
     }
 
+    @Override
+    public MdcEquipmentStatisticalInfo findMdcEquipmentStatisticalInfo(String equipmentId, String date) {
+        return this.baseMapper.findMdcEquipmentStatisticalInfo(equipmentId, date.replaceAll("-", ""));
+    }
+
     private List<EquipmentStatisticalInfo> dataHandle(List<MdcEquipmentStatisticalInfo> list) {
         List<EquipmentStatisticalInfo> result = new ArrayList<>();
         list.forEach(item -> {
@@ -137,7 +143,12 @@
                     endDate = DateUtils.setTimeForDay(DateUtils.plusTime(now, -1), planTime);
                 }
                 List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.listForEquipmentStatisticalInfo(equipment.getEquipmentid(), startDate, endDate);
-                return this.statisticsData(equipmentRunningSectionList, planTime, startDate, endDate, equipment);
+                try {
+                    return this.statisticsData(equipmentRunningSectionList, planTime, startDate, endDate, equipment);
+                } catch (Exception e) {
+                    throw new JeecgBootException("璁惧缂栧彿锛�" + equipment.getEquipmentid());
+                }
+
             } else {
                 //寰呴獙璇�
                 Date end = DateUtils.plusTime(initDate, 1);
@@ -269,20 +280,22 @@
                 long processingLong = 0L;
                 long closedLong = 0L;
                 long errorLong = 0L;
-                for (Map<String, Long> n : dayList) {
-                    long du = n.get("duration");
-                    int status = new Long(n.get("status")).intValue();
-                    if (status == 2) {
-                        waitingLong += du;
-                    }
-                    if (status == 3) {
-                        processingLong += du;
-                    }
-                    if (status == 0) {
-                        closedLong += du;
-                    }
-                    if (status == 22) {
-                        errorLong += du;
+                if (dayList != null && !dayList.isEmpty()) {
+                    for (Map<String, Long> n : dayList) {
+                        long du = n.get("duration");
+                        int status = new Long(n.get("status")).intValue();
+                        if (status == 2) {
+                            waitingLong += du;
+                        }
+                        if (status == 3) {
+                            processingLong += du;
+                        }
+                        if (status == 0) {
+                            closedLong += du;
+                        }
+                        if (status == 22) {
+                            errorLong += du;
+                        }
                     }
                 }
                 equipmentStatisticalInfo.setWaitLong(new BigDecimal(waitingLong));

--
Gitblit v1.9.3