修改bug

This commit is contained in:
yangjun 2026-03-03 09:29:03 +08:00
parent f96efd2460
commit 887d1bea1b
1 changed files with 28 additions and 28 deletions

View File

@ -92,41 +92,41 @@ public class ConfigSuppliersInfoServiceImpl extends ServiceImpl<ConfigSuppliersI
.filter(xs -> xs != null) // 过滤掉null的供应商物料
.anyMatch(xs -> {
// 安全的字段比较允许null值
boolean materialNameMatch = (wl.getMaterialName() == null && xs.getMaterialName() == null) ||
(wl.getMaterialName() != null && xs.getMaterialName() != null &&
wl.getMaterialName().equals(xs.getMaterialName()));
// boolean materialNameMatch = (wl.getMaterialName() == null && xs.getMaterialName() == null) ||
// (wl.getMaterialName() != null && xs.getMaterialName() != null &&
// wl.getMaterialName().equals(xs.getMaterialName()));
//
// boolean specificationModelMatch = (wl.getSpecificationModel() == null && xs.getSpecificationModel() == null) ||
// (wl.getSpecificationModel() != null && xs.getSpecificationModel() != null &&
// wl.getSpecificationModel().equals(xs.getSpecificationModel()));
//
// boolean brandTypeMatch = (wl.getBrandType() == null && xs.getBrandType() == null) ||
// (wl.getBrandType() != null && xs.getBrandType() != null &&
// wl.getBrandType().equals(xs.getBrandType()));
boolean specificationModelMatch = (wl.getSpecificationModel() == null && xs.getSpecificationModel() == null) ||
(wl.getSpecificationModel() != null && xs.getSpecificationModel() != null &&
wl.getSpecificationModel().equals(xs.getSpecificationModel()));
boolean brandTypeMatch = (wl.getBrandType() == null && xs.getBrandType() == null) ||
(wl.getBrandType() != null && xs.getBrandType() != null &&
wl.getBrandType().equals(xs.getBrandType()));
return materialNameMatch && specificationModelMatch && brandTypeMatch;
return true;
})
)
.map(wl -> {
// 找到对应的xs项目
NuBizSuppliersMaterialInfo matchedXs = xsList.stream()
.filter(xs -> xs != null)
.filter(xs -> {
// 同样的匹配逻辑
boolean materialNameMatch = (wl.getMaterialName() == null && xs.getMaterialName() == null) ||
(wl.getMaterialName() != null && xs.getMaterialName() != null &&
wl.getMaterialName().equals(xs.getMaterialName()));
boolean specificationModelMatch = (wl.getSpecificationModel() == null && xs.getSpecificationModel() == null) ||
(wl.getSpecificationModel() != null && xs.getSpecificationModel() != null &&
wl.getSpecificationModel().equals(xs.getSpecificationModel()));
boolean brandTypeMatch = (wl.getBrandType() == null && xs.getBrandType() == null) ||
(wl.getBrandType() != null && xs.getBrandType() != null &&
wl.getBrandType().equals(xs.getBrandType()));
return materialNameMatch && specificationModelMatch && brandTypeMatch;
})
// .filter(xs -> {
// // 同样的匹配逻辑
// boolean materialNameMatch = (wl.getMaterialName() == null && xs.getMaterialName() == null) ||
// (wl.getMaterialName() != null && xs.getMaterialName() != null &&
// wl.getMaterialName().equals(xs.getMaterialName()));
//
// boolean specificationModelMatch = (wl.getSpecificationModel() == null && xs.getSpecificationModel() == null) ||
// (wl.getSpecificationModel() != null && xs.getSpecificationModel() != null &&
// wl.getSpecificationModel().equals(xs.getSpecificationModel()));
//
// boolean brandTypeMatch = (wl.getBrandType() == null && xs.getBrandType() == null) ||
// (wl.getBrandType() != null && xs.getBrandType() != null &&
// wl.getBrandType().equals(xs.getBrandType()));
//
// return materialNameMatch && specificationModelMatch && brandTypeMatch;
// })
.findFirst()
.orElse(null);