From 15a20a91316b726f45ccc9e06bbd632f10eedb43 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期五, 13 九月 2024 14:10:55 +0800 Subject: [PATCH] update --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java | 83 ++++++++++++++++++++++++++++++++--------- 1 files changed, 64 insertions(+), 19 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java index 83817f6..bc8cac9 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java @@ -21,10 +21,7 @@ import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil; import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil; -import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo; -import org.jeecg.modules.mdc.vo.MdcEquipmentProVo; -import org.jeecg.modules.mdc.vo.MdcEquipmentVo; -import org.jeecg.modules.mdc.vo.WorkshopEquipmentVo; +import org.jeecg.modules.mdc.vo.*; import org.jeecg.modules.system.entity.MdcEquipmentDepart; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.MdcProductionEquipment; @@ -230,7 +227,7 @@ } @Override - public List<MdcEquipmentTree> loadTreeListByDepart(String userId) { + public List<MdcEquipmentTree> loadTreeListByDepart(String userId, String key) { //鑾峰彇鎵�鏈夐儴闂ㄦ暟鎹� List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(SysDepart::getDepartOrder)); //鏍规嵁鐢ㄦ埛ID鑾峰彇鎷ユ湁鐨勯儴闂╥d闆嗗悎 @@ -247,7 +244,7 @@ //缁勮閮ㄩ棬璁惧鏍� List<MdcEquipmentTree> treeList = FindsEquipmentDepartUtil.wrapEquipmentDepartTreeList(list); //濉厖璁惧鏁版嵁 - FillEquipmentByDepart(treeList); + FillEquipmentByDepart(treeList, key); return treeList; } @@ -256,9 +253,9 @@ * * @param treeList */ - private void FillEquipmentByDepart(List<MdcEquipmentTree> treeList) { + private void FillEquipmentByDepart(List<MdcEquipmentTree> treeList, String key) { for (MdcEquipmentTree mdcEquipmentTree : treeList) { - List<MdcEquipment> equipmentList = this.baseMapper.queryByDepartId(mdcEquipmentTree.getKey()); + List<MdcEquipment> equipmentList = this.baseMapper.queryByDepartId(mdcEquipmentTree.getKey(), key); if (equipmentList != null && !equipmentList.isEmpty()) { for (MdcEquipment mdcEquipment : equipmentList) { MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment); @@ -268,7 +265,7 @@ mdcEquipmentTree.setLeaf(false); } if (!mdcEquipmentTree.getChildren().isEmpty()) { - FillEquipmentByDepart(mdcEquipmentTree.getChildren()); + FillEquipmentByDepart(mdcEquipmentTree.getChildren(), key); } } } @@ -295,7 +292,7 @@ @Override - public List<MdcEquipmentTree> loadTreeListByProduction(String userId) { + public List<MdcEquipmentTree> loadTreeListByProduction(String userId, String key) { //鑾峰彇鎵�鏈変骇绾挎暟鎹� List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder)); //鏍规嵁鐢ㄦ埛id鑾峰彇鎷ユ湁鐨勪骇绾夸俊鎭泦鍚� @@ -312,7 +309,7 @@ //缁勮浜х嚎璁惧鏍� List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); //濉厖璁惧鏁版嵁 - FillEquipmentByProduction(treeList); + FillEquipmentByProduction(treeList, key); return treeList; } @@ -378,6 +375,9 @@ ControlSystem controlSystem = controlSystemService.getByDriveType(mdcEquipmentDto.getDriveType()); // 鏌ヨ璁惧鐘舵�� EquipmentLog equipmentLog = equipmentLogService.selectEquipmentOporation(mdcEquipment.getEquipmentId()); + if (equipmentLog == null) { + return mdcEquipmentDto; + } Integer oporation = equipmentLog.getOporation(); if (controlSystem != null) { @@ -632,9 +632,9 @@ /** * 浜х嚎璁惧鏍戝~鍏呰澶囨暟鎹� */ - private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList) { + private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList, String key) { for (MdcEquipmentTree mdcEquipmentTree : treeList) { - List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey()); + List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey(), key); if (equipmentList != null && !equipmentList.isEmpty()) { for (MdcEquipment mdcEquipment : equipmentList) { MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment); @@ -644,7 +644,7 @@ mdcEquipmentTree.setLeaf(false); } if (!mdcEquipmentTree.getChildren().isEmpty()) { - FillEquipmentByProduction(mdcEquipmentTree.getChildren()); + FillEquipmentByProduction(mdcEquipmentTree.getChildren(), key); } } } @@ -724,8 +724,25 @@ } @Override - public List<String> listEquipmentId(String equipmentType, List<String> equipmentIdList) { - List<MdcEquipment> list = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentType, equipmentType).in(MdcEquipment::getEquipmentId, equipmentIdList)); + public List<String> listEquipmentId(MdcEfficiencyReportQueryVo vo) { + LambdaQueryWrapper<MdcEquipment> queryWrapper = new LambdaQueryWrapper<>(); + if (vo.getEquipmentIdList() != null && !vo.getEquipmentIdList().isEmpty()) { + queryWrapper.in(MdcEquipment::getEquipmentId, vo.getEquipmentIdList()); + } + if (StringUtils.isNotEmpty(vo.getEquipmentType())) { + queryWrapper.in(MdcEquipment::getEquipmentType, Arrays.asList(vo.getEquipmentType().split(","))); + } + if (StringUtils.isNotEmpty(vo.getDeviceLevel())) { + queryWrapper.in(MdcEquipment::getDeviceLevel, Arrays.asList(vo.getDeviceLevel().split(","))); + } + if (StringUtils.isNotEmpty(vo.getDriveType())) { + queryWrapper.in(MdcEquipment::getDriveType, Arrays.asList(vo.getDriveType().split(","))); + } + if (StringUtils.isNotEmpty(vo.getDeviceCategory())) { + queryWrapper.in(MdcEquipment::getDeviceCategory, Arrays.asList(vo.getDeviceCategory().split(","))); + } + List<MdcEquipment> list = super.list(queryWrapper); +// List<MdcEquipment> list = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentType, equipmentType).in(MdcEquipment::getEquipmentId, equipmentIdList)); return list.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList()); } @@ -772,7 +789,7 @@ Integer min = mdcEquipmentThreshold.getMinThreshold(); MessageDTO messageDTO = new MessageDTO(); messageDTO.setTitle("璁惧" + mdcEquipmentThreshold.getChineseName() + "鎶ヨ锛�"); - messageDTO.setCategory("棰勮娑堟伅"); + messageDTO.setCategory(CommonConstant.MSG_CATEGORY_2); messageDTO.setFromUser("admin"); messageDTO.setToUser("admin"); MdcOverrunAlarm mdcOverrunAlarm = new MdcOverrunAlarm(); @@ -838,18 +855,46 @@ //缁勮浜х嚎璁惧鏍� List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); //濉厖璁惧鏁版嵁 - FillEquipmentByProduction(treeList); + FillEquipmentByProduction(treeList, null); return treeList; } /** * 鏌ヨ鍗曡〃鏁版嵁 + * * @param tableName * @return */ @Override public MdcEquipmentDto getWorkLineLast(String tableName) { - return this.baseMapper.findWorkLineLast(tableName); + try { + return this.baseMapper.findWorkLineLast(tableName); + } catch (Exception e) { + return null; + } + } + + @Override + public List<String> listEquipmentIdShift(MdcEfficiencyReportShiftQueryVo vo) { + LambdaQueryWrapper<MdcEquipment> queryWrapper = new LambdaQueryWrapper<>(); + if (vo.getEquipmentIdList() != null && !vo.getEquipmentIdList().isEmpty()) { + queryWrapper.in(MdcEquipment::getEquipmentId, vo.getEquipmentIdList()); + } + if (StringUtils.isNotEmpty(vo.getEquipmentType())) { + queryWrapper.in(MdcEquipment::getEquipmentType, Arrays.asList(vo.getEquipmentType().split(","))); + } + if (StringUtils.isNotEmpty(vo.getDeviceLevel())) { + queryWrapper.in(MdcEquipment::getDeviceLevel, Arrays.asList(vo.getDeviceLevel().split(","))); + } + if (StringUtils.isNotEmpty(vo.getDriveType())) { + queryWrapper.in(MdcEquipment::getDriveType, Arrays.asList(vo.getDriveType().split(","))); + } + if (StringUtils.isNotEmpty(vo.getDeviceCategory())) { + queryWrapper.in(MdcEquipment::getDeviceCategory, Arrays.asList(vo.getDeviceCategory().split(","))); + } + List<MdcEquipment> list = super.list(queryWrapper); +// List<MdcEquipment> list = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentType, equipmentType).in(MdcEquipment::getEquipmentId, equipmentIdList)); + return list.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList()); } } -- Gitblit v1.9.3