whycxzp
2022-09-07 3ce1a98dc7411418f63836e1c011818ae2bd5501
修复
1个文件已修改
22 ■■■■ 已修改文件
src/main/java/com/whyc/service/ProductService.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductService.java
@@ -336,16 +336,18 @@
                        mpList = mphService.getListWithMaterialInfo(mpList);
                        List<String> newBomMaterialStrList = bomList.stream().map(bom -> bom.getSubCode() + "/" + bom.getSubModel()).collect(Collectors.toList());
                        mpList = mpList.stream().filter(mp -> newBomMaterialStrList.contains(mp.getSubMaterial().getSubCode() + "/" + mp.getSubMaterial().getSubModel())).collect(Collectors.toList());
                        if (latestProduct.getVersion().intValue() == enabledProduct.getVersion()) {
                            //最新版本生效,关联关系版本连着的
                            mphService.updateVersionBatch(mpList);
                        } else {
                            //旧版本生效,关联关系版本不连着
                            mpList.forEach(mp -> {
                                mp.setSVersion(nextVersion);
                                mp.setEVersion(nextVersion);
                            });
                            mphService.insertBatch(mpList);
                        if(mpList.size()!=0) {
                            if (latestProduct.getVersion().intValue() == enabledProduct.getVersion()) {
                                //最新版本生效,关联关系版本连着的
                                mphService.updateVersionBatch(mpList);
                            } else {
                                //旧版本生效,关联关系版本不连着
                                mpList.forEach(mp -> {
                                    mp.setSVersion(nextVersion);
                                    mp.setEVersion(nextVersion);
                                });
                                mphService.insertBatch(mpList);
                            }
                        }
                    }
                }