fix(ebom): 调整事务位置
This commit is contained in:
parent
be2a133e2b
commit
d4788a1d4a
|
|
@ -56,6 +56,7 @@ public class EBomImportService {
|
||||||
@Resource
|
@Resource
|
||||||
private BomNewEbomChildService bomNewEbomChildService;
|
private BomNewEbomChildService bomNewEbomChildService;
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public List<OperationErrorMsgVO> importBom(MultipartFile file) throws IOException {
|
public List<OperationErrorMsgVO> importBom(MultipartFile file) throws IOException {
|
||||||
try {
|
try {
|
||||||
rowNum.set(1);
|
rowNum.set(1);
|
||||||
|
|
@ -89,13 +90,15 @@ public class EBomImportService {
|
||||||
ebomChildService.updateEBomMaterialUse(pcs.getRight().stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet()));
|
ebomChildService.updateEBomMaterialUse(pcs.getRight().stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||||
|
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("导入ebom异常", ex);
|
||||||
|
throw ex;
|
||||||
} finally {
|
} finally {
|
||||||
excelContextTL.remove();
|
excelContextTL.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
private void save(List<BomNewEbomParentEntity> parents, List<BomNewEbomChildEntity> children) {
|
||||||
public void save(List<BomNewEbomParentEntity> parents, List<BomNewEbomChildEntity> children) {
|
|
||||||
Set<String> pMaterialNos = parents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet());
|
Set<String> pMaterialNos = parents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet());
|
||||||
List<BomNewEbomParentEntity> oldParents = bomNewEbomParentService.getLatestByMaterialNo(pMaterialNos);
|
List<BomNewEbomParentEntity> oldParents = bomNewEbomParentService.getLatestByMaterialNo(pMaterialNos);
|
||||||
oldParents.forEach(p -> {
|
oldParents.forEach(p -> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue