lxp
2025-03-15 5a697e6fafbe3855336ca5fd7e1785de12840d16
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsProductServiceImpl.java
@@ -432,11 +432,13 @@
        if(sampleIds.contains(insSample.getId())) {
            list = selectTemperatureByProductId(productId);
        }else {
            // 将温度循环id过滤
            productIds = productIds.stream().filter(item -> !item.equals(productId)).collect(Collectors.toList());
            // 撤销的是检验项
            List<InsProduct> productList = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>()
           List<InsProduct> productList   = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>()
                    .eq(InsProduct::getState, 1)
                    .eq(InsProduct::getSpecialItemParentId,productId)
                    .in(InsProduct::getId, productIds));
                    .in(CollectionUtils.isNotEmpty(productIds),InsProduct::getId, productIds));
            Map<String, List<InsProduct>> collect = productList.stream().collect(Collectors.groupingBy(InsProduct::getInspectionItem));
            // 拿到循环次数
            Iterator<Map.Entry<String, List<InsProduct>>> iterator = collect.entrySet().iterator();
@@ -475,12 +477,14 @@
        if(sampleIds.contains(insSample.getId())) {
             list = selectTemperatureNumberByProductId(parentId, inspectionItem);
        }else {
            // 过滤出温度循环的id
            productIds = productIds.stream().filter(item -> !item.equals(parentId)).collect(Collectors.toList());
            // 查询撤销的温度点
            List<InsProduct> productList = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>()
                    .eq(InsProduct::getState, 1)
                    .eq(InsProduct::getSpecialItemParentId, parentId)
                    .eq(InsProduct::getInspectionItem, inspectionItem)
                    .in(InsProduct::getId, productIds));
                    .in(CollectionUtils.isNotEmpty(productIds),InsProduct::getId, productIds));
            // 根据检验子项得到温度点
            Map<String, List<InsProduct>> collect = productList.stream().collect(Collectors.groupingBy(InsProduct::getInspectionItemSubclass));
            Iterator<Map.Entry<String, List<InsProduct>>> iterator = collect.entrySet().iterator();
@@ -525,7 +529,16 @@
            List<InsProduct> productList = insProductMapper.selectList(new LambdaQueryWrapper<InsProduct>()
                    .in(InsProduct::getId, productIds));
            if(CollectionUtils.isNotEmpty(productList)) {
                // 得判断一下 是否含有温度循环项目
                // 如果撤销的项目是温度循环  那么相应的子项需要全部撤销
                List<InsProduct> collect3 = productList.stream().filter(item -> item.getInspectionItem().equals("温度循环")).collect(Collectors.toList());
                if(CollectionUtils.isNotEmpty(collect3)) {
                    for (InsProduct a : collect3) {
                        insProductMapper.update(null,new LambdaUpdateWrapper<InsProduct>()
                                .set(InsProduct::getState,0)
                                .eq(InsProduct::getSpecialItemParentId,a.getId()));
                    }
                }
                // 如果是某一个温度 是否含有温度循环子项
                List<InsProduct> collect2 = productList.stream().filter(item -> Objects.nonNull(item.getSpecialItemParentId())
                        && NumberUtil.isInteger(item.getInspectionItem())).collect(Collectors.toList());
                if(CollectionUtils.isNotEmpty(collect2)) {