feat: 数据不一致增加子节点数量校验
This commit is contained in:
parent
0c358b6887
commit
1a0caf4017
|
|
@ -132,11 +132,19 @@ public class DQBomImportService {
|
||||||
if (oldParent != null) {
|
if (oldParent != null) {
|
||||||
if (!parent.getMaterialUnit().equals(oldParent.getMaterialUnit())
|
if (!parent.getMaterialUnit().equals(oldParent.getMaterialUnit())
|
||||||
|| !parent.getMaterialTexture().equals(oldParent.getMaterialTexture())) {
|
|| !parent.getMaterialTexture().equals(oldParent.getMaterialTexture())) {
|
||||||
throw new NflgBusinessException(STATE.InconsistentDataError, "");
|
throw new NflgBusinessException(STATE.InconsistentDataError, "物料信息不一致");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> cc = children.stream().filter(c -> c.getParentRowId().equals(parent.getRowId()))
|
List<String> cc = children.stream().filter(c -> c.getParentRowId().equals(parent.getRowId()))
|
||||||
.map(BomNewDQbomChildEntity::getMaterialNo)
|
.map(BomNewDQbomChildEntity::getMaterialNo)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
List<String> oc = dQBomChildService.lambdaQuery().eq(BomNewDQbomChildEntity::getParentRowId, oldParent.getRowId())
|
||||||
|
.list()
|
||||||
|
.stream().map(BomNewDQbomChildEntity::getMaterialNo).collect(Collectors.toList());
|
||||||
|
if (cc.size() != oc.size()) {
|
||||||
|
throw new NflgBusinessException(STATE.InconsistentDataError, "子级节点数量不一致");
|
||||||
|
}
|
||||||
|
|
||||||
List<BomNewDQbomParentEntity> ps = parents.stream().filter(p -> cc.contains(p.getMaterialNo()))
|
List<BomNewDQbomParentEntity> ps = parents.stream().filter(p -> cc.contains(p.getMaterialNo()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
for (BomNewDQbomParentEntity p : ps) {
|
for (BomNewDQbomParentEntity p : ps) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue