From 39f62fa03a2463652e971edfabab56313db6af10 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期六, 28 六月 2025 10:20:34 +0800 Subject: [PATCH] 涉密->工控 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java | 70 ++++++++++++++++++++--------------- 1 files changed, 40 insertions(+), 30 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 07bbabf..1b9b0c7 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 @@ -101,18 +101,18 @@ mdcEquipmentStatisticalInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId()); mdcEquipmentStatisticalInfoMonth.setTheMonth(date); if (mdcEquipmentStatisticalDto != null) { - mdcEquipmentStatisticalInfoMonth.setCloseLong(mdcEquipmentStatisticalDto.getCloseLong().intValue()); - mdcEquipmentStatisticalInfoMonth.setErrorLong(mdcEquipmentStatisticalDto.getErrorLong().intValue()); - mdcEquipmentStatisticalInfoMonth.setOpenLong(mdcEquipmentStatisticalDto.getOpenLong().intValue()); - mdcEquipmentStatisticalInfoMonth.setProcessLong(mdcEquipmentStatisticalDto.getProcessLong().intValue()); - mdcEquipmentStatisticalInfoMonth.setWaitLong(mdcEquipmentStatisticalDto.getWaitLong().intValue()); - mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); - mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); - mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); - mdcEquipmentStatisticalInfoMonth.setFaultLong(mdcEquipmentStatisticalDto.getFaultLong().intValue()); - mdcEquipmentStatisticalInfoMonth.setFaultRate(mdcEquipmentStatisticalDto.getFaultRate()); - mdcEquipmentStatisticalInfoMonth.setRemoveFaultRate(mdcEquipmentStatisticalDto.getRemoveFaultRate()); - mdcEquipmentStatisticalInfoMonth.setRemoveFaultRunLong(mdcEquipmentStatisticalDto.getRemoveFaultRunLong().intValue()); + mdcEquipmentStatisticalInfoMonth.setCloseLong(mdcEquipmentStatisticalDto.getCloseLong() == null ? 0 : mdcEquipmentStatisticalDto.getCloseLong().intValue()); + mdcEquipmentStatisticalInfoMonth.setErrorLong(mdcEquipmentStatisticalDto.getErrorLong() == null ? 0 : mdcEquipmentStatisticalDto.getErrorLong().intValue()); + mdcEquipmentStatisticalInfoMonth.setOpenLong(mdcEquipmentStatisticalDto.getOpenLong() == null ? 0 : mdcEquipmentStatisticalDto.getOpenLong().intValue()); + mdcEquipmentStatisticalInfoMonth.setProcessLong(mdcEquipmentStatisticalDto.getProcessLong() == null ? 0 : mdcEquipmentStatisticalDto.getProcessLong().intValue()); + mdcEquipmentStatisticalInfoMonth.setWaitLong(mdcEquipmentStatisticalDto.getWaitLong() == null ? 0 : mdcEquipmentStatisticalDto.getWaitLong().intValue()); + mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong() == null || mdcEquipmentStatisticalDto.getDayNum() == null ? BigDecimal.ZERO : mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); + mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong() == null || mdcEquipmentStatisticalDto.getProcessLong() == null ? BigDecimal.ZERO : (mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO)); + mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong() == null || mdcEquipmentStatisticalDto.getDayNum() == null ? BigDecimal.ZERO : mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); + mdcEquipmentStatisticalInfoMonth.setFaultLong(mdcEquipmentStatisticalDto.getFaultLong() == null ? 0 : mdcEquipmentStatisticalDto.getFaultLong().intValue()); + mdcEquipmentStatisticalInfoMonth.setFaultRate(mdcEquipmentStatisticalDto.getFaultRate() == null ? BigDecimal.ZERO : mdcEquipmentStatisticalDto.getFaultRate()); + mdcEquipmentStatisticalInfoMonth.setRemoveFaultRate(mdcEquipmentStatisticalDto.getRemoveFaultRate() == null ? BigDecimal.ZERO : mdcEquipmentStatisticalDto.getRemoveFaultRate()); + mdcEquipmentStatisticalInfoMonth.setRemoveFaultRunLong(mdcEquipmentStatisticalDto.getRemoveFaultRunLong() == null ? 0 : mdcEquipmentStatisticalDto.getRemoveFaultRunLong().intValue()); } mdcEquipmentStatisticalInfoMonthList.add(mdcEquipmentStatisticalInfoMonth); // step.3 姹囨�荤彮娆″埄鐢ㄧ巼鏁版嵁 @@ -122,15 +122,25 @@ mdcEquipmentShiftInfoMonth.setTheMonth(date); mdcEquipmentShiftInfoMonth.setShiftType(CommonConstant.SHIFT_TYPE_1); if (mdcEquipmentShiftStatisticalDto != null) { - mdcEquipmentShiftInfoMonth.setCloseLong(mdcEquipmentShiftStatisticalDto.getCloseLong().intValue()); - mdcEquipmentShiftInfoMonth.setTotalLong(mdcEquipmentShiftStatisticalDto.getTotalLong().intValue()); - mdcEquipmentShiftInfoMonth.setOpenLong(mdcEquipmentShiftStatisticalDto.getOpenLong().intValue()); - mdcEquipmentShiftInfoMonth.setErrorLong(mdcEquipmentShiftStatisticalDto.getErrorLong().intValue()); - mdcEquipmentShiftInfoMonth.setWaitLong(mdcEquipmentShiftStatisticalDto.getWaitLong().intValue()); - mdcEquipmentShiftInfoMonth.setProcessLong(mdcEquipmentShiftStatisticalDto.getProcessLong().intValue()); - mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); - mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); - mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); + mdcEquipmentShiftInfoMonth.setCloseLong(mdcEquipmentShiftStatisticalDto.getCloseLong() == null ? 0 : mdcEquipmentShiftStatisticalDto.getCloseLong().intValue()); + mdcEquipmentShiftInfoMonth.setTotalLong(mdcEquipmentShiftStatisticalDto.getTotalLong() == null ? 0 : mdcEquipmentShiftStatisticalDto.getTotalLong().intValue()); + mdcEquipmentShiftInfoMonth.setOpenLong(mdcEquipmentShiftStatisticalDto.getOpenLong() == null ? 0 : mdcEquipmentShiftStatisticalDto.getOpenLong().intValue()); + mdcEquipmentShiftInfoMonth.setErrorLong(mdcEquipmentShiftStatisticalDto.getErrorLong() == null ? 0 : mdcEquipmentShiftStatisticalDto.getErrorLong().intValue()); + mdcEquipmentShiftInfoMonth.setWaitLong(mdcEquipmentShiftStatisticalDto.getWaitLong() == null ? 0 : mdcEquipmentShiftStatisticalDto.getWaitLong().intValue()); + mdcEquipmentShiftInfoMonth.setProcessLong(mdcEquipmentShiftStatisticalDto.getProcessLong() == null ? 0 : mdcEquipmentShiftStatisticalDto.getProcessLong().intValue()); + mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong() == null || mdcEquipmentShiftStatisticalDto.getProcessLong() == null ? BigDecimal.ZERO : (mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO)); + mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong() == null || mdcEquipmentShiftStatisticalDto.getProcessLong() == null ? BigDecimal.ZERO : (mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO)); + mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getOpenLong() == null || mdcEquipmentShiftStatisticalDto.getTotalLong() == null ? BigDecimal.ZERO : (mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO)); + } else { + mdcEquipmentShiftInfoMonth.setCloseLong(0); + mdcEquipmentShiftInfoMonth.setTotalLong(0); + mdcEquipmentShiftInfoMonth.setOpenLong(0); + mdcEquipmentShiftInfoMonth.setErrorLong(0); + mdcEquipmentShiftInfoMonth.setWaitLong(0); + mdcEquipmentShiftInfoMonth.setProcessLong(0); + mdcEquipmentShiftInfoMonth.setUtilizationRate(BigDecimal.ZERO); + mdcEquipmentShiftInfoMonth.setStartRate(BigDecimal.ZERO); + mdcEquipmentShiftInfoMonth.setOpenRate(BigDecimal.ZERO); } mdcEquipmentStatisticalShiftInfoMonthList.add(mdcEquipmentShiftInfoMonth); // step.4 姹囨�诲悇鐝鍒╃敤鐜囨暟鎹� @@ -141,15 +151,15 @@ 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).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); - equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); - equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); + equipmentStatisticalShiftInfoMonth.setCloseLong(equipmentStatisticalDto.getCloseLong() == null ? 0 : equipmentStatisticalDto.getCloseLong().intValue()); + equipmentStatisticalShiftInfoMonth.setTotalLong(equipmentStatisticalDto.getTotalLong() == null ? 0 : equipmentStatisticalDto.getTotalLong().intValue()); + equipmentStatisticalShiftInfoMonth.setOpenLong(equipmentStatisticalDto.getOpenLong() == null ? 0 : equipmentStatisticalDto.getOpenLong().intValue()); + equipmentStatisticalShiftInfoMonth.setErrorLong(equipmentStatisticalDto.getErrorLong() == null ? 0 : equipmentStatisticalDto.getErrorLong().intValue()); + equipmentStatisticalShiftInfoMonth.setWaitLong(equipmentStatisticalDto.getWaitLong() == null ? 0 : equipmentStatisticalDto.getWaitLong().intValue()); + equipmentStatisticalShiftInfoMonth.setProcessLong(equipmentStatisticalDto.getProcessLong() == null ? 0 : equipmentStatisticalDto.getProcessLong().intValue()); + equipmentStatisticalShiftInfoMonth.setUtilizationRate(equipmentStatisticalDto.getTotalLong() == null || equipmentStatisticalDto.getProcessLong() == null ? BigDecimal.ZERO : (equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO)); + equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong() == null || equipmentStatisticalDto.getProcessLong() == null ? BigDecimal.ZERO : (equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO)); + equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong() == null || equipmentStatisticalDto.getOpenLong() == null ? BigDecimal.ZERO : (equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO)); mdcEquipmentStatisticalShiftInfoMonthList.add(equipmentStatisticalShiftInfoMonth); } } -- Gitblit v1.9.3