From 2b9ff0c274a847af41b2f5a04de1b23ed6fbb9bb Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期一, 25 八月 2025 15:50:15 +0800 Subject: [PATCH] mdc模块更新 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java | 316 +++++++++------------------------------------------- 1 files changed, 55 insertions(+), 261 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java index c8dd286..1a99ab7 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java @@ -115,56 +115,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 +170,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 +381,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 +396,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 +451,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 +679,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 +706,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 +755,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 +783,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<>(); @@ -1729,11 +1528,6 @@ } return result; - } - - @Override - public List<BigDecimal> getEfficiencyRate(String equipmentId, String date) { - return mdcEfficiencyReportMapper.getEfficiencyRate(equipmentId, date); } private MdcUtilizationResultDto utilizationRate(String equipmentId, String equipmentName, String equipmentType, Date startTime, Date endTime, String date, List<MdcUtilizationRate> mdcUtilizationRateList) { -- Gitblit v1.9.3