From 0d978c2fcf7ce97c90ee25297f9ebf37079bc18a Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期四, 18 四月 2024 10:05:53 +0800 Subject: [PATCH] 首页利用率排序 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java index dc7a99f..2198c50 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java +++ b/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)); -- Gitblit v1.9.3