Lius
2023-12-07 4337640b7ab86136baed2fd6aa959e4828a75cea
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -19,7 +19,6 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.Collator;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
@@ -97,6 +96,15 @@
        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
            result.setMdcEfficiencyList(listDtos);
        } else {
            if (StringUtils.isNotEmpty(vo.getEquipmentType())) {
                List<String> equipmentList = mdcEquipmentService.listEquipmentId(vo.getEquipmentType(), vo.getEquipmentIdList());
                if (equipmentList != null && !equipmentList.isEmpty()) {
                    vo.setEquipmentIdList(equipmentList);
                } else {
                    result.setMdcEfficiencyList(listDtos);
                    return result;
                }
            }
            // 查询利用率数据
            List<MdcEfficiencyDto> efficiencyList = mdcEfficiencyReportMapper.efficiencyList(vo);
            // 利用率等级
@@ -107,7 +115,7 @@
                // 部门层级
                List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList());
                // 查询所有部门信息
                List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName));
                List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartOrder));
                for (MdcEquDepDto mdcEquDepDto : equipmentList) {
                    MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto();
@@ -169,7 +177,7 @@
                // 产线层级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // 查询所有产线信息
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()));
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder));
                for (MdcEquProDto mdcEquProDto : equipmentList) {
                    MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto();
@@ -227,7 +235,7 @@
                    listDtos.add(mdcEfficiencyListDto);
                }
            }
            listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3())));
            //listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3())));
            result.setMdcEfficiencyList(listDtos);
        }
@@ -277,6 +285,15 @@
        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
            result.setMdcEfficiencyList(listDtos);
        } else {
            if (StringUtils.isNotEmpty(vo.getEquipmentType())) {
                List<String> equipmentList = mdcEquipmentService.listEquipmentId(vo.getEquipmentType(), vo.getEquipmentIdList());
                if (equipmentList != null && !equipmentList.isEmpty()) {
                    vo.setEquipmentIdList(equipmentList);
                } else {
                    result.setMdcEfficiencyList(listDtos);
                    return result;
                }
            }
            // 查询利用率数据
            List<MdcEfficiencyDto> efficiencyList = mdcEfficiencyReportMapper.efficiencyPOList(vo);
            // 利用率等级
@@ -287,7 +304,7 @@
                // 部门层级
                List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList());
                // 查询所有部门信息
                List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName));
                List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartOrder));
                for (MdcEquDepDto mdcEquDepDto : equipmentList) {
                    MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto();
@@ -349,7 +366,7 @@
                // 产线层级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // 查询所有产线信息
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()));
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder));
                for (MdcEquProDto mdcEquProDto : equipmentList) {
                    MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto();
@@ -407,7 +424,7 @@
                    listDtos.add(mdcEfficiencyListDto);
                }
            }
            listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3())));
//            listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3())));
            result.setMdcEfficiencyList(listDtos);
        }
@@ -457,6 +474,15 @@
        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
            result.setMdcEfficiencyList(listDtos);
        } else {
            if (StringUtils.isNotEmpty(vo.getEquipmentType())) {
                List<String> equipmentList = mdcEquipmentService.listEquipmentId(vo.getEquipmentType(), vo.getEquipmentIdList());
                if (equipmentList != null && !equipmentList.isEmpty()) {
                    vo.setEquipmentIdList(equipmentList);
                } else {
                    result.setMdcEfficiencyList(listDtos);
                    return result;
                }
            }
            // 班次利用率等级
            List<MdcUtilizationRate> mdcUtilizationRateList = mdcUtilizationRateService.listByType("bclyl");
            // 班次利用率数据
@@ -467,7 +493,7 @@
                // 部门层级
                List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList());
                // 查询所有部门信息
                List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName));
                List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartOrder));
                // 班次名称显示处理
                String shiftSubName = "";
                if (StringUtils.isBlank(vo.getShiftId())) {
@@ -550,7 +576,7 @@
                // 产线层级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // 查询所有产线信息
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()));
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder));
                // 班次名称显示处理
                String shiftSubName = "";
@@ -630,7 +656,7 @@
                    listDtos.add(mdcEfficiencyShiftListDto);
                }
            }
            listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3())));
//            listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3())));
            result.setMdcEfficiencyList(listDtos);
        }
        return result;
@@ -795,7 +821,7 @@
            }
        } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) {
            // 单台设备信息
            vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId()));
            vo.setEquipmentIdList(Arrays.asList(vo.getEquipmentId().split(",")));
        } else {
            // 查询用户拥有的所有设备信息
            if ("2".equals(vo.getTypeTree())) {