From 5cd4558fb1a7178653d77e1a982e6f26d06b5db5 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期一, 31 三月 2025 17:39:00 +0800
Subject: [PATCH] 中心综合利用率趋势接口

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java
index 2749b4a..456f302 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java
@@ -3,6 +3,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
 import org.jeecg.modules.mdc.entity.MdcEquipment;
 import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth;
@@ -113,6 +114,7 @@
                     MdcEquipmentStatisticalShiftInfoMonth mdcEquipmentShiftInfoMonth = new MdcEquipmentStatisticalShiftInfoMonth();
                     mdcEquipmentShiftInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId());
                     mdcEquipmentShiftInfoMonth.setTheMonth(date);
+                    mdcEquipmentShiftInfoMonth.setShiftType(CommonConstant.SHIFT_TYPE_1);
                     mdcEquipmentShiftInfoMonth.setCloseLong(mdcEquipmentShiftStatisticalDto.getCloseLong().intValue());
                     mdcEquipmentShiftInfoMonth.setTotalLong(mdcEquipmentShiftStatisticalDto.getTotalLong().intValue());
                     mdcEquipmentShiftInfoMonth.setOpenLong(mdcEquipmentShiftStatisticalDto.getOpenLong().intValue());
@@ -123,6 +125,26 @@
                     mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                     mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                     mdcEquipmentStatisticalShiftInfoMonthList.add(mdcEquipmentShiftInfoMonth);
+                    // step.4 姹囨�诲悇鐝鍒╃敤鐜囨暟鎹�
+                    List<MdcEquipmentStatisticalDto> essdList = mdcEquipmentStatisticalShiftInfoService.findShiftByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date);
+                    if (essdList != null && !essdList.isEmpty()) {
+                        for (MdcEquipmentStatisticalDto equipmentStatisticalDto : essdList) {
+                            MdcEquipmentStatisticalShiftInfoMonth equipmentStatisticalShiftInfoMonth = new MdcEquipmentStatisticalShiftInfoMonth();
+                            equipmentStatisticalShiftInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId());
+                            equipmentStatisticalShiftInfoMonth.setTheMonth(date);
+                            equipmentStatisticalShiftInfoMonth.setShiftType(CommonConstant.SHIFT_TYPE_2);
+                            equipmentStatisticalShiftInfoMonth.setCloseLong(equipmentStatisticalDto.getCloseLong().intValue());
+                            equipmentStatisticalShiftInfoMonth.setTotalLong(equipmentStatisticalDto.getTotalLong().intValue());
+                            equipmentStatisticalShiftInfoMonth.setOpenLong(equipmentStatisticalDto.getOpenLong().intValue());
+                            equipmentStatisticalShiftInfoMonth.setErrorLong(equipmentStatisticalDto.getErrorLong().intValue());
+                            equipmentStatisticalShiftInfoMonth.setWaitLong(equipmentStatisticalDto.getWaitLong().intValue());
+                            equipmentStatisticalShiftInfoMonth.setProcessLong(equipmentStatisticalDto.getProcessLong().intValue());
+                            equipmentStatisticalShiftInfoMonth.setUtilizationRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
+                            equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
+                            equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
+                            mdcEquipmentStatisticalShiftInfoMonthList.add(equipmentStatisticalShiftInfoMonth);
+                        }
+                    }
                 }
             }
             if (!mdcEquipmentStatisticalInfoMonthList.isEmpty()) {

--
Gitblit v1.9.3