Lius
2024-04-18 0d978c2fcf7ce97c90ee25297f9ebf37079bc18a
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.mdc.service.impl;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalInfoDto;
import org.jeecg.modules.mdc.entity.EquipmentLog;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
@@ -144,6 +145,9 @@
                result.add(mdcCommonVo);
            }
        }
        if (!result.isEmpty()) {
            result.sort(Comparator.comparing(MdcCommonVo::getValue).reversed());
        }
        return result;
    }
@@ -249,12 +253,13 @@
        String end = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-1).toString(), DateUtils.STR_DATE), DateUtils.STRDATE);
        if (equipmentIdList != null && !equipmentIdList.isEmpty()) {
            result.put("equipmentIdList", equipmentIdList);
            List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoList = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end);
            List<MdcEquipmentStatisticalInfoDto> mdcEquipmentStatisticalInfoList = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end);
            List<EquipmentDayUtilizationVo> dataList = new ArrayList<>();
            if (mdcEquipmentStatisticalInfoList != null && !mdcEquipmentStatisticalInfoList.isEmpty()) {
                for (MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo : mdcEquipmentStatisticalInfoList) {
                for (MdcEquipmentStatisticalInfoDto mdcEquipmentStatisticalInfo : mdcEquipmentStatisticalInfoList) {
                    EquipmentDayUtilizationVo equipmentDayUtilizationVo = new EquipmentDayUtilizationVo();
                    equipmentDayUtilizationVo.setEquipmentId(mdcEquipmentStatisticalInfo.getEquipmentId());
                    equipmentDayUtilizationVo.setEquipmentName(mdcEquipmentStatisticalInfo.getEquipmentName());
                    equipmentDayUtilizationVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(mdcEquipmentStatisticalInfoList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
                    if (BigDecimal.ZERO.compareTo(mdcEquipmentStatisticalInfo.getOpenLong()) == -1) {
                        equipmentDayUtilizationVo.setOpenRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));