feat(ebom): 修复last_version_is的设置问题
This commit is contained in:
parent
0e80f4e4f7
commit
c702a95282
|
|
@ -102,6 +102,7 @@ public class EBomImportService {
|
|||
private void save(List<BomNewEbomParentEntity> parents, List<BomNewEbomChildEntity> children) {
|
||||
Set<String> pMaterialNos = parents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet());
|
||||
List<BomNewEbomParentEntity> oldParents = bomNewEbomParentService.getLatestByMaterialNo(pMaterialNos);
|
||||
if (CollUtil.isNotEmpty(oldParents)) {
|
||||
oldParents.forEach(p -> {
|
||||
if (!Objects.equals(p.getStatus(), EBomStatusEnum.PUBLISHED.getValue())) {
|
||||
bomNewEbomParentService.getBaseMapper().deleteById(p.getRowId());
|
||||
|
|
@ -109,15 +110,14 @@ public class EBomImportService {
|
|||
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
||||
it.setCurrentVersion(p.getCurrentVersion());
|
||||
});
|
||||
p.setLastVersionIs(0);
|
||||
} else {
|
||||
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
||||
it.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(p.getCurrentVersion()));
|
||||
});
|
||||
}
|
||||
});
|
||||
//bomNewEbomParentService.setLastVersionIs0(oldParents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||
bomNewEbomParentService.updateBatchById(oldParents.stream().filter(f -> f.getLastVersionIs() == 0).collect(Collectors.toList()));
|
||||
bomNewEbomParentService.setLastVersionIs0(oldParents.stream().map(BomNewEbomParentEntity::getRowId).collect(Collectors.toList()));
|
||||
}
|
||||
bomNewEbomParentService.saveBatch(parents);
|
||||
bomNewEbomChildService.saveBatch(children);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue