Lius
2025-08-19 057d3af95ae0346b98e394bdbbaa2c5a7c34f4af
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -9,12 +9,14 @@
import org.jeecg.modules.mdc.mapper.MdcEfficiencyReportMapper;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.util.JexlFormulaCalculator;
import org.jeecg.modules.mdc.vo.MdcUtilizationRateDto;
import org.jeecg.modules.mdc.vo.*;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.service.ISysDepartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -53,6 +55,12 @@
    @Resource
    private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService;
    @Resource
    private IMdcParameterService mdcParameterService;
    @Resource
    private JexlFormulaCalculator formulaCalculator;
    /**
     * 利用率报表
@@ -115,56 +123,22 @@
            if ("2".equals(vo.getTypeTree())) {
                // 部门层级
                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::getDepartOrder));
                for (MdcEquDepDto mdcEquDepDto : equipmentList) {
                    MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto();
                    mdcEfficiencyListDto.setEquipmentId(mdcEquDepDto.getEquipmentId());
                    mdcEfficiencyListDto.setEquipmentName(mdcEquDepDto.getEquipmentName());
                    mdcEfficiencyListDto.setEquipmentType(mdcEquDepDto.getEquipmentType());
                    switch (mdcEquDepDto.getOrgType()) {
                        case "1":
                            mdcEfficiencyListDto.setLevel1(mdcEquDepDto.getDepartName());
                            break;
                        case "2":
                            mdcEfficiencyListDto.setLevel2(mdcEquDepDto.getDepartName());
                            break;
                        case "3":
                            mdcEfficiencyListDto.setLevel3(mdcEquDepDto.getDepartName());
                            break;
                        default:
                    }
                    SysDepart sysDepart = departList.stream().filter(depart -> depart.getId().equals(mdcEquDepDto.getParentId())).findAny().orElse(null);
                    if (sysDepart != null) {
                        switch (sysDepart.getOrgType()) {
                            case "1":
                                mdcEfficiencyListDto.setLevel1(sysDepart.getDepartName());
                                break;
                            case "2":
                                mdcEfficiencyListDto.setLevel2(sysDepart.getDepartName());
                                break;
                            case "3":
                                mdcEfficiencyListDto.setLevel3(sysDepart.getDepartName());
                                break;
                            default:
                    String orgCode = mdcEquDepDto.getOrgCode();
                    if (orgCode != null) {
                        if (orgCode.length() >= 3) {
                            mdcEfficiencyListDto.setLevel1(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 3))).getDepartName());
                        }
                        if (StringUtils.isNotEmpty(sysDepart.getParentId())) {
                            departList.stream().filter(depart -> depart.getId().equals(sysDepart.getParentId())).findAny().ifPresent(depart1 -> {
                                switch (depart1.getOrgType()) {
                                    case "1":
                                        mdcEfficiencyListDto.setLevel1(depart1.getDepartName());
                                        break;
                                    case "2":
                                        mdcEfficiencyListDto.setLevel2(depart1.getDepartName());
                                        break;
                                    case "3":
                                        mdcEfficiencyListDto.setLevel3(depart1.getDepartName());
                                        break;
                                    default:
                                }
                            });
                        if (orgCode.length() >= 6) {
                            mdcEfficiencyListDto.setLevel2(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 6))).getDepartName());
                        }
                        if (orgCode.length() >= 9) {
                            mdcEfficiencyListDto.setLevel3(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 9))).getDepartName());
                        }
                    }
                    List<MdcEfficiencyResultDto> list = new ArrayList<>();
@@ -204,55 +178,22 @@
            } else {
                // 产线层级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // 查询所有产线信息
                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();
                    mdcEfficiencyListDto.setEquipmentId(mdcEquProDto.getEquipmentId());
                    mdcEfficiencyListDto.setEquipmentName(mdcEquProDto.getEquipmentName());
                    mdcEfficiencyListDto.setEquipmentType(mdcEquProDto.getEquipmentType());
                    switch (mdcEquProDto.getOrgType()) {
                        case "1":
                            mdcEfficiencyListDto.setLevel1(mdcEquProDto.getProductionName());
                            break;
                        case "2":
                            mdcEfficiencyListDto.setLevel2(mdcEquProDto.getProductionName());
                            break;
                        case "3":
                            mdcEfficiencyListDto.setLevel3(mdcEquProDto.getProductionName());
                            break;
                        default:
                    }
                    MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (mdcProduction != null) {
                        switch (mdcProduction.getOrgType()) {
                            case "1":
                                mdcEfficiencyListDto.setLevel1(mdcProduction.getProductionName());
                                break;
                            case "2":
                                mdcEfficiencyListDto.setLevel2(mdcProduction.getProductionName());
                                break;
                            case "3":
                                mdcEfficiencyListDto.setLevel3(mdcProduction.getProductionName());
                                break;
                            default:
                    String orgCode = mdcEquProDto.getOrgCode();
                    if (orgCode != null) {
                        if (orgCode.length() >= 3) {
                            mdcEfficiencyListDto.setLevel1(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 3))).getProductionName());
                        }
                        if (StringUtils.isNotEmpty(mdcProduction.getParentId())) {
                            productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> {
                                switch (production1.getOrgType()) {
                                    case "1":
                                        mdcEfficiencyListDto.setLevel1(production1.getProductionName());
                                        break;
                                    case "2":
                                        mdcEfficiencyListDto.setLevel2(production1.getProductionName());
                                        break;
                                    case "3":
                                        mdcEfficiencyListDto.setLevel3(production1.getProductionName());
                                        break;
                                    default:
                                }
                            });
                        if (orgCode.length() >= 6) {
                            mdcEfficiencyListDto.setLevel2(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 6))).getProductionName());
                        }
                        if (orgCode.length() >= 9) {
                            mdcEfficiencyListDto.setLevel3(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 9))).getProductionName());
                        }
                    }
                    List<MdcEfficiencyResultDto> list = new ArrayList<>();
@@ -448,7 +389,7 @@
        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
            result.setMdcEfficiencyList(listDtos);
        } else {
            List<String> equipmentIdList = mdcEquipmentService.listEquipmentId(vo);
            if (equipmentIdList != null && !equipmentIdList.isEmpty()) {
                vo.setEquipmentIdList(equipmentIdList);
@@ -463,56 +404,22 @@
            if ("2".equals(vo.getTypeTree())) {
                // 部门层级
                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::getDepartOrder));
                for (MdcEquDepDto mdcEquDepDto : equipmentList) {
                    MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto();
                    mdcEfficiencyListDto.setEquipmentId(mdcEquDepDto.getEquipmentId());
                    mdcEfficiencyListDto.setEquipmentName(mdcEquDepDto.getEquipmentName());
                    mdcEfficiencyListDto.setEquipmentType(mdcEquDepDto.getEquipmentType());
                    switch (mdcEquDepDto.getOrgType()) {
                        case "1":
                            mdcEfficiencyListDto.setLevel1(mdcEquDepDto.getDepartName());
                            break;
                        case "2":
                            mdcEfficiencyListDto.setLevel2(mdcEquDepDto.getDepartName());
                            break;
                        case "3":
                            mdcEfficiencyListDto.setLevel3(mdcEquDepDto.getDepartName());
                            break;
                        default:
                    }
                    SysDepart sysDepart = departList.stream().filter(depart -> depart.getId().equals(mdcEquDepDto.getParentId())).findAny().orElse(null);
                    if (sysDepart != null) {
                        switch (sysDepart.getOrgType()) {
                            case "1":
                                mdcEfficiencyListDto.setLevel1(sysDepart.getDepartName());
                                break;
                            case "2":
                                mdcEfficiencyListDto.setLevel2(sysDepart.getDepartName());
                                break;
                            case "3":
                                mdcEfficiencyListDto.setLevel3(sysDepart.getDepartName());
                                break;
                            default:
                    String orgCode = mdcEquDepDto.getOrgCode();
                    if (orgCode != null) {
                        if (orgCode.length() >= 3) {
                            mdcEfficiencyListDto.setLevel1(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 3))).getDepartName());
                        }
                        if (StringUtils.isNotEmpty(sysDepart.getParentId())) {
                            departList.stream().filter(depart -> depart.getId().equals(sysDepart.getParentId())).findAny().ifPresent(depart1 -> {
                                switch (depart1.getOrgType()) {
                                    case "1":
                                        mdcEfficiencyListDto.setLevel1(depart1.getDepartName());
                                        break;
                                    case "2":
                                        mdcEfficiencyListDto.setLevel2(depart1.getDepartName());
                                        break;
                                    case "3":
                                        mdcEfficiencyListDto.setLevel3(depart1.getDepartName());
                                        break;
                                    default:
                                }
                            });
                        if (orgCode.length() >= 6) {
                            mdcEfficiencyListDto.setLevel2(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 6))).getDepartName());
                        }
                        if (orgCode.length() >= 9) {
                            mdcEfficiencyListDto.setLevel3(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 9))).getDepartName());
                        }
                    }
                    List<MdcEfficiencyResultDto> list = new ArrayList<>();
@@ -552,55 +459,22 @@
            } else {
                // 产线层级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // 查询所有产线信息
                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();
                    mdcEfficiencyListDto.setEquipmentId(mdcEquProDto.getEquipmentId());
                    mdcEfficiencyListDto.setEquipmentName(mdcEquProDto.getEquipmentName());
                    mdcEfficiencyListDto.setEquipmentType(mdcEquProDto.getEquipmentType());
                    switch (mdcEquProDto.getOrgType()) {
                        case "1":
                            mdcEfficiencyListDto.setLevel1(mdcEquProDto.getProductionName());
                            break;
                        case "2":
                            mdcEfficiencyListDto.setLevel2(mdcEquProDto.getProductionName());
                            break;
                        case "3":
                            mdcEfficiencyListDto.setLevel3(mdcEquProDto.getProductionName());
                            break;
                        default:
                    }
                    MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (mdcProduction != null) {
                        switch (mdcProduction.getOrgType()) {
                            case "1":
                                mdcEfficiencyListDto.setLevel1(mdcProduction.getProductionName());
                                break;
                            case "2":
                                mdcEfficiencyListDto.setLevel2(mdcProduction.getProductionName());
                                break;
                            case "3":
                                mdcEfficiencyListDto.setLevel3(mdcProduction.getProductionName());
                                break;
                            default:
                    String orgCode = mdcEquProDto.getOrgCode();
                    if (orgCode != null) {
                        if (orgCode.length() >= 3) {
                            mdcEfficiencyListDto.setLevel1(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 3))).getProductionName());
                        }
                        if (StringUtils.isNotEmpty(mdcProduction.getParentId())) {
                            productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> {
                                switch (production1.getOrgType()) {
                                    case "1":
                                        mdcEfficiencyListDto.setLevel1(production1.getProductionName());
                                        break;
                                    case "2":
                                        mdcEfficiencyListDto.setLevel2(production1.getProductionName());
                                        break;
                                    case "3":
                                        mdcEfficiencyListDto.setLevel3(production1.getProductionName());
                                        break;
                                    default:
                                }
                            });
                        if (orgCode.length() >= 6) {
                            mdcEfficiencyListDto.setLevel2(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 6))).getProductionName());
                        }
                        if (orgCode.length() >= 9) {
                            mdcEfficiencyListDto.setLevel3(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 9))).getProductionName());
                        }
                    }
                    List<MdcEfficiencyResultDto> list = new ArrayList<>();
@@ -813,8 +687,6 @@
            if ("2".equals(vo.getTypeTree())) {
                // 部门层级
                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::getDepartOrder));
                // 班次名称显示处理
                String shiftSubName = "";
                if (StringUtils.isBlank(vo.getShiftId())) {
@@ -842,48 +714,16 @@
                    mdcEfficiencyShiftListDto.setEquipmentName(mdcEquDepDto.getEquipmentName());
                    mdcEfficiencyShiftListDto.setEquipmentType(mdcEquDepDto.getEquipmentType());
                    mdcEfficiencyShiftListDto.setShiftSubName(shiftSubName);
                    switch (mdcEquDepDto.getOrgType()) {
                        case "1":
                            mdcEfficiencyShiftListDto.setLevel1(mdcEquDepDto.getDepartName());
                            break;
                        case "2":
                            mdcEfficiencyShiftListDto.setLevel2(mdcEquDepDto.getDepartName());
                            break;
                        case "3":
                            mdcEfficiencyShiftListDto.setLevel3(mdcEquDepDto.getDepartName());
                            break;
                        default:
                    }
                    SysDepart sysDepart = departList.stream().filter(depart -> depart.getId().equals(mdcEquDepDto.getParentId())).findAny().orElse(null);
                    if (sysDepart != null) {
                        switch (sysDepart.getOrgType()) {
                            case "1":
                                mdcEfficiencyShiftListDto.setLevel1(sysDepart.getDepartName());
                                break;
                            case "2":
                                mdcEfficiencyShiftListDto.setLevel2(sysDepart.getDepartName());
                                break;
                            case "3":
                                mdcEfficiencyShiftListDto.setLevel3(sysDepart.getDepartName());
                                break;
                            default:
                    String orgCode = mdcEquDepDto.getOrgCode();
                    if (orgCode != null) {
                        if (orgCode.length() >= 3) {
                            mdcEfficiencyShiftListDto.setLevel1(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 3))).getDepartName());
                        }
                        if (StringUtils.isNotEmpty(sysDepart.getParentId())) {
                            departList.stream().filter(depart -> depart.getId().equals(sysDepart.getParentId())).findAny().ifPresent(depart1 -> {
                                switch (depart1.getOrgType()) {
                                    case "1":
                                        mdcEfficiencyShiftListDto.setLevel1(depart1.getDepartName());
                                        break;
                                    case "2":
                                        mdcEfficiencyShiftListDto.setLevel2(depart1.getDepartName());
                                        break;
                                    case "3":
                                        mdcEfficiencyShiftListDto.setLevel3(depart1.getDepartName());
                                        break;
                                    default:
                                }
                            });
                        if (orgCode.length() >= 6) {
                            mdcEfficiencyShiftListDto.setLevel2(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 6))).getDepartName());
                        }
                        if (orgCode.length() >= 9) {
                            mdcEfficiencyShiftListDto.setLevel3(sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(SysDepart::getOrgCode, orgCode.substring(0, 9))).getDepartName());
                        }
                    }
                    List<MdcEfficiencyShiftResultDto> list = new ArrayList<>();
@@ -923,8 +763,6 @@
            } else {
                // 产线层级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // 查询所有产线信息
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder));
                // 班次名称显示处理
                String shiftSubName = "";
@@ -953,47 +791,16 @@
                    mdcEfficiencyShiftListDto.setEquipmentName(mdcEquProDto.getEquipmentName());
                    mdcEfficiencyShiftListDto.setEquipmentType(mdcEquProDto.getEquipmentType());
                    mdcEfficiencyShiftListDto.setShiftSubName(shiftSubName);
                    switch (mdcEquProDto.getOrgType()) {
                        case "1":
                            mdcEfficiencyShiftListDto.setLevel1(mdcEquProDto.getProductionName());
                            break;
                        case "2":
                            mdcEfficiencyShiftListDto.setLevel2(mdcEquProDto.getProductionName());
                            break;
                        case "3":
                            mdcEfficiencyShiftListDto.setLevel3(mdcEquProDto.getProductionName());
                            break;
                        default:
                    }
                    MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (mdcProduction != null) {
                        switch (mdcProduction.getOrgType()) {
                            case "1":
                                mdcEfficiencyShiftListDto.setLevel1(mdcProduction.getProductionName());
                                break;
                            case "2":
                                mdcEfficiencyShiftListDto.setLevel2(mdcProduction.getProductionName());
                                break;
                            case "3":
                                mdcEfficiencyShiftListDto.setLevel3(mdcProduction.getProductionName());
                                break;
                            default:
                    String orgCode = mdcEquProDto.getOrgCode();
                    if (orgCode != null) {
                        if (orgCode.length() >= 3) {
                            mdcEfficiencyShiftListDto.setLevel1(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 3))).getProductionName());
                        }
                        if (StringUtils.isNotEmpty(mdcProduction.getParentId())) {
                            productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> {
                                switch (production1.getOrgType()) {
                                    case "1":
                                        mdcEfficiencyShiftListDto.setLevel1(production1.getProductionName());
                                        break;
                                    case "2":
                                        mdcEfficiencyShiftListDto.setLevel2(production1.getProductionName());
                                        break;
                                    case "3":
                                        mdcEfficiencyShiftListDto.setLevel3(production1.getProductionName());
                                        break;
                                    default:
                                }
                            });
                        if (orgCode.length() >= 6) {
                            mdcEfficiencyShiftListDto.setLevel2(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 6))).getProductionName());
                        }
                        if (orgCode.length() >= 9) {
                            mdcEfficiencyShiftListDto.setLevel3(mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).eq(MdcProduction::getOrgCode, orgCode.substring(0, 9))).getProductionName());
                        }
                    }
                    List<MdcEfficiencyShiftResultDto> list = new ArrayList<>();
@@ -1151,19 +958,45 @@
                if (date.equals(equipmentStatisticalShiftInfo.getTheDate()) && equipmentStatisticalShiftInfo.getEquipmentId().equals(equipmentId)) {
                    mdcEfficiencyShiftResultDto.setTheDate(equipmentStatisticalShiftInfo.getTheDate());
                    mdcEfficiencyShiftResultDto.setProcessLong(equipmentStatisticalShiftInfo.getProcessLong());
                    if (equipmentStatisticalShiftInfo.getTotalLong().compareTo(BigDecimal.ZERO) == 0) {
                        mdcEfficiencyShiftResultDto.setUtilizationRate(BigDecimal.ZERO);
                    } else {
                        mdcEfficiencyShiftResultDto.setUtilizationRate(equipmentStatisticalShiftInfo.getProcessLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP));
                    }
                    mdcEfficiencyShiftResultDto.setCloseLong(equipmentStatisticalShiftInfo.getCloseLong());
                    mdcEfficiencyShiftResultDto.setOpenLong(equipmentStatisticalShiftInfo.getOpenLong());
                    mdcEfficiencyShiftResultDto.setWaitLong(equipmentStatisticalShiftInfo.getWaitLong());
                    if (equipmentStatisticalShiftInfo.getTotalLong().compareTo(BigDecimal.ZERO) == 0) {
                        mdcEfficiencyShiftResultDto.setOpenRate(BigDecimal.ZERO);
                    Map<String, Object> variables = new HashMap<>();
                    variables.put("processLong", equipmentStatisticalShiftInfo.getProcessLong());
                    variables.put("openLong", equipmentStatisticalShiftInfo.getOpenLong());
                    variables.put("totalLong", equipmentStatisticalShiftInfo.getTotalLong());
                    MdcParameter shiftUtilizationRate = mdcParameterService.getOne(new LambdaQueryWrapper<MdcParameter>().eq(MdcParameter::getCode, "shiftUtilizationRate"));
                    if (shiftUtilizationRate != null) {
                        mdcEfficiencyShiftResultDto.setUtilizationRate(formulaCalculator.calculate(shiftUtilizationRate.getValue(), variables));
                    } else {
                        mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP));
                        if (equipmentStatisticalShiftInfo.getTotalLong().compareTo(BigDecimal.ZERO) == 0) {
                            mdcEfficiencyShiftResultDto.setUtilizationRate(BigDecimal.ZERO);
                        } else {
                            mdcEfficiencyShiftResultDto.setUtilizationRate(equipmentStatisticalShiftInfo.getProcessLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP));
                        }
                    }
                    MdcParameter shiftOpenRate = mdcParameterService.getOne(new LambdaQueryWrapper<MdcParameter>().eq(MdcParameter::getCode, "shiftOpenRate"));
                    if (shiftOpenRate != null) {
                        mdcEfficiencyShiftResultDto.setOpenRate(formulaCalculator.calculate(shiftOpenRate.getValue(), variables));
                    } else {
                        if (equipmentStatisticalShiftInfo.getTotalLong().compareTo(BigDecimal.ZERO) == 0) {
                            mdcEfficiencyShiftResultDto.setOpenRate(BigDecimal.ZERO);
                        } else {
                            mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP));
                        }
                    }
                    MdcParameter startRate = mdcParameterService.getOne(new LambdaQueryWrapper<MdcParameter>().eq(MdcParameter::getCode, "startRate"));
                    if (startRate != null) {
                        mdcEfficiencyShiftResultDto.setStartRate(formulaCalculator.calculate(startRate.getValue(), variables));
                    } else {
                        if (equipmentStatisticalShiftInfo.getOpenLong().compareTo(BigDecimal.ZERO) == 0) {
                            mdcEfficiencyShiftResultDto.setStartRate(BigDecimal.ZERO);
                        } else {
                            mdcEfficiencyShiftResultDto.setStartRate(equipmentStatisticalShiftInfo.getProcessLong().divide(equipmentStatisticalShiftInfo.getOpenLong(), 6, RoundingMode.HALF_UP));
                        }
                    }
                    long rate = mdcEfficiencyShiftResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -1792,12 +1625,31 @@
                if (date.equals(efficiencyDto.getTheDate()) && efficiencyDto.getEquipmentId().equals(equipmentId)) {
                    mdcEfficiencyResultDto.setTheDate(efficiencyDto.getTheDate());
                    mdcEfficiencyResultDto.setProcessLong(efficiencyDto.getProcessLong());
                    mdcEfficiencyResultDto.setUtilizationRate(efficiencyDto.getUtilizationRate());
                    mdcEfficiencyResultDto.setStartRate(efficiencyDto.getStartRate());
                    mdcEfficiencyResultDto.setOpenRate(efficiencyDto.getOpenRate());
                    mdcEfficiencyResultDto.setOpenLong(efficiencyDto.getOpenLong());
                    mdcEfficiencyResultDto.setWaitLong(efficiencyDto.getWaitLong());
                    mdcEfficiencyResultDto.setCloseLong(efficiencyDto.getCloseLong());
                    Map<String, Object> variables = new HashMap<>();
                    variables.put("processLong", efficiencyDto.getProcessLong());
                    variables.put("openLong", efficiencyDto.getOpenLong());
                    variables.put("measureTime", new BigDecimal("86400"));
                    MdcParameter utilizationRate = mdcParameterService.getOne(new LambdaQueryWrapper<MdcParameter>().eq(MdcParameter::getCode, "utilizationRate"));
                    if (utilizationRate != null) {
                        mdcEfficiencyResultDto.setUtilizationRate(formulaCalculator.calculate(utilizationRate.getValue(), variables));
                    } else {
                        mdcEfficiencyResultDto.setUtilizationRate(efficiencyDto.getUtilizationRate());
                    }
                    MdcParameter openRate = mdcParameterService.getOne(new LambdaQueryWrapper<MdcParameter>().eq(MdcParameter::getCode, "openRate"));
                    if (openRate != null) {
                        mdcEfficiencyResultDto.setOpenRate(formulaCalculator.calculate(openRate.getValue(), variables));
                    } else {
                        mdcEfficiencyResultDto.setOpenRate(efficiencyDto.getOpenRate());
                    }
                    MdcParameter startRate = mdcParameterService.getOne(new LambdaQueryWrapper<MdcParameter>().eq(MdcParameter::getCode, "startRate"));
                    if (startRate != null) {
                        mdcEfficiencyResultDto.setStartRate(formulaCalculator.calculate(startRate.getValue(), variables));
                    } else {
                        mdcEfficiencyResultDto.setStartRate(efficiencyDto.getStartRate());
                    }
                    long rate = efficiencyDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {