yangbin
2025-02-20 710df8489c740910bda9a557d9a7fdc6cf39df41
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.mdc.subcontrol.service.impl;
import org.apache.commons.lang.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.jeecg.modules.mdc.entity.EquipmentLog;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.subcontrol.service.MdcBigScreenService;
@@ -34,6 +35,8 @@
    private IEquipmentStatisticalInfoService equipmentStatisticalInfoService;
    @Autowired
    private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService;
    @Autowired
    private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService;
    @Resource
@@ -126,11 +129,17 @@
            List<LastWeekDataVo> lastWeekDataVos = equipmentStatisticalInfoService.findDataRankingForBigScreen(equipmentIdList, monday, saturday);
            if (!lastWeekDataVos.isEmpty()) {
                for (LastWeekDataVo lastWeekDataVo : lastWeekDataVos) {
                    Long size = equipmentStatisticalInfoService.selectSize(lastWeekDataVo.getEquipment(), monday, saturday);
                    lastWeekDataVo.setUtilization(new BigDecimal(String.format("%.2f", (Float.parseFloat(lastWeekDataVo.getProcessingLong()) / (86400 * size) * 100))));
                    Long size = mdcEquipmentStatisticalInfoService.selectSize(lastWeekDataVo.getEquipment(), monday, saturday);
                    if (StringUtils.isNotEmpty(lastWeekDataVo.getProcessingLong()) && Float.parseFloat(lastWeekDataVo.getProcessingLong()) >0) {
                        lastWeekDataVo.setUtilization(new BigDecimal(String.format("%.2f",
                                (Float.parseFloat(lastWeekDataVo.getProcessingLong()) / (86400 * size) * 100))));
                    } else {
                        lastWeekDataVo.setUtilization(new BigDecimal(0));
                    }
                }
                List<LastWeekDataVo> collect = lastWeekDataVos.stream().sorted(Comparator.comparing(LastWeekDataVo::getUtilization).reversed()).collect(Collectors.toList());
                if (collect.size() > 3) {
                if (collect.size() > 6) {
                    List<LastWeekDataVo> topList = collect.subList(0, 6);
                    for (LastWeekDataVo vo : topList) {
                        LastWeekDataRankingVo rankingVo = new LastWeekDataRankingVo();
@@ -138,6 +147,13 @@
                        rankingVo.setTopRate(vo.getUtilization().toString());
                        voList.add(rankingVo);
                    }
                } else {
                    for (LastWeekDataVo vo : collect) {
                        LastWeekDataRankingVo rankingVo = new LastWeekDataRankingVo();
                        rankingVo.setTopName(vo.getEquipment());
                        rankingVo.setTopRate(vo.getUtilization().toString());
                        voList.add(rankingVo);
                    }
                }
            }