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 | 139 +++++++++++++++++++--------------------------- 1 files changed, 58 insertions(+), 81 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 1e21981..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 @@ -227,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闆嗗悎 @@ -244,7 +244,7 @@ //缁勮閮ㄩ棬璁惧鏍� List<MdcEquipmentTree> treeList = FindsEquipmentDepartUtil.wrapEquipmentDepartTreeList(list); //濉厖璁惧鏁版嵁 - FillEquipmentByDepart(treeList); + FillEquipmentByDepart(treeList, key); return treeList; } @@ -253,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); @@ -265,7 +265,7 @@ mdcEquipmentTree.setLeaf(false); } if (!mdcEquipmentTree.getChildren().isEmpty()) { - FillEquipmentByDepart(mdcEquipmentTree.getChildren()); + FillEquipmentByDepart(mdcEquipmentTree.getChildren(), key); } } } @@ -292,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鑾峰彇鎷ユ湁鐨勪骇绾夸俊鎭泦鍚� @@ -309,7 +309,7 @@ //缁勮浜х嚎璁惧鏍� List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); //濉厖璁惧鏁版嵁 - FillEquipmentByProduction(treeList); + FillEquipmentByProduction(treeList, key); return treeList; } @@ -375,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) { @@ -629,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); @@ -641,7 +644,7 @@ mdcEquipmentTree.setLeaf(false); } if (!mdcEquipmentTree.getChildren().isEmpty()) { - FillEquipmentByProduction(mdcEquipmentTree.getChildren()); + FillEquipmentByProduction(mdcEquipmentTree.getChildren(), key); } } } @@ -721,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()); } @@ -769,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(); @@ -835,89 +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<MdcCommonVo> getEquipmentStatusStatistics(String userId, String key) { - List<MdcCommonVo> result = new ArrayList<>(); - MdcCommonVo mdcCommonVo1 = new MdcCommonVo(); - mdcCommonVo1.setName("鍏虫満"); - mdcCommonVo1.setValue(0); - result.add(mdcCommonVo1); - MdcCommonVo mdcCommonVo2 = new MdcCommonVo(); - mdcCommonVo2.setName("鎶ヨ"); - mdcCommonVo2.setValue(0); - result.add(mdcCommonVo2); - MdcCommonVo mdcCommonVo3 = new MdcCommonVo(); - mdcCommonVo3.setName("寰呮満"); - mdcCommonVo3.setValue(0); - result.add(mdcCommonVo3); - MdcCommonVo mdcCommonVo4 = new MdcCommonVo(); - mdcCommonVo4.setName("杩愯"); - mdcCommonVo4.setValue(0); - result.add(mdcCommonVo4); - MdcEquipmentStatusVo mdcEquipmentStatusVo = new MdcEquipmentStatusVo(); - List<String> equipmentIdList = this.getEquipmentIdsProduction(userId, key); - if (equipmentIdList == null || equipmentIdList.isEmpty()) { - return result; + public List<String> listEquipmentIdShift(MdcEfficiencyReportShiftQueryVo vo) { + LambdaQueryWrapper<MdcEquipment> queryWrapper = new LambdaQueryWrapper<>(); + if (vo.getEquipmentIdList() != null && !vo.getEquipmentIdList().isEmpty()) { + queryWrapper.in(MdcEquipment::getEquipmentId, vo.getEquipmentIdList()); } - List<EquipmentLog> logList = this.baseMapper.getEquipmentStatusList(equipmentIdList); - if (logList != null && !logList.isEmpty()) { - for (EquipmentLog equipmentLog : logList) { - if (equipmentLog.getOporation() != null) { - switch (equipmentLog.getOporation()) { - case 1: - case 2: - mdcEquipmentStatusVo.setWaitCount(mdcEquipmentStatusVo.getWaitCount() + 1); - break; - case 3: - mdcEquipmentStatusVo.setRunCount(mdcEquipmentStatusVo.getRunCount() + 1); - break; - case 22: - mdcEquipmentStatusVo.setAlarmCount(mdcEquipmentStatusVo.getAlarmCount() + 1); - break; - default: - mdcEquipmentStatusVo.setCloseCount(mdcEquipmentStatusVo.getCloseCount() + 1); - break; - } - } else { - mdcEquipmentStatusVo.setCloseCount(mdcEquipmentStatusVo.getCloseCount() + 1); - } - } + if (StringUtils.isNotEmpty(vo.getEquipmentType())) { + queryWrapper.in(MdcEquipment::getEquipmentType, Arrays.asList(vo.getEquipmentType().split(","))); } - result.clear(); - MdcCommonVo mdcCommonVo5 = new MdcCommonVo(); - mdcCommonVo5.setName("鍏虫満"); - mdcCommonVo5.setValue(mdcEquipmentStatusVo.getCloseCount()); - result.add(mdcCommonVo5); - MdcCommonVo mdcCommonVo6 = new MdcCommonVo(); - mdcCommonVo6.setName("鎶ヨ"); - mdcCommonVo6.setValue(mdcEquipmentStatusVo.getAlarmCount()); - result.add(mdcCommonVo6); - MdcCommonVo mdcCommonVo7 = new MdcCommonVo(); - mdcCommonVo7.setName("寰呮満"); - mdcCommonVo7.setValue(mdcEquipmentStatusVo.getWaitCount()); - result.add(mdcCommonVo7); - MdcCommonVo mdcCommonVo8 = new MdcCommonVo(); - mdcCommonVo8.setName("杩愯"); - mdcCommonVo8.setValue(mdcEquipmentStatusVo.getRunCount()); - result.add(mdcCommonVo8); - return result; + 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