浏览代码

Merge branch 'test-merge' of http://219.151.181.73:3000/zhuwei/bladex into test-merge

lvy 4 天之前
父节点
当前提交
f8e716f755

+ 12 - 10
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -2189,16 +2189,18 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 if(StringUtils.isNotEmpty(node.getPartitionCode())){
                     nodePartitionCode=node.getPartitionCode();
                 }else {
-                    List<WbsTreeContract> list = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda().in(WbsTreeContract::getPKeyId, node.getAncestorsPId()).in(WbsTreeContract::getNodeType, Arrays.asList(4, 5)));
-                    if(!list.isEmpty()){
-                        // 获取第一个节点类型为5的元素
-                        WbsTreeContract result = list.stream().filter(item -> item.getNodeType() == 5).findFirst().orElse(null);
-                        if(result!=null){
-                            nodePartitionCode=result.getPartitionCode();
-                        }else {
-                            WbsTreeContract result2 = list.stream().filter(item -> item.getNodeType() == 4).findFirst().orElse(null);
-                            if(result2!=null){
-                                nodePartitionCode=result2.getPartitionCode();
+                    if(StringUtils.isNotEmpty(node.getAncestorsPId())){
+                        List<WbsTreeContract> list = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda().in(WbsTreeContract::getPKeyId, Func.toLongList(",", node.getAncestorsPId())).in(WbsTreeContract::getNodeType, Arrays.asList(4, 5)));
+                        if(!list.isEmpty()){
+                            // 获取第一个节点类型为5的元素
+                            WbsTreeContract result = list.stream().filter(item -> item.getNodeType() == 5).findFirst().orElse(null);
+                            if(result!=null){
+                                nodePartitionCode=result.getPartitionCode();
+                            }else {
+                                WbsTreeContract result2 = list.stream().filter(item -> item.getNodeType() == 4).findFirst().orElse(null);
+                                if(result2!=null){
+                                    nodePartitionCode=result2.getPartitionCode();
+                                }
                             }
                         }
                     }

+ 8 - 15
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -2967,7 +2967,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public R importTree(MultipartFile file, Long pkeyId) throws IOException {
         //最高节点
         WbsTreeContract wbsTreeContractRoot = baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda().eq(WbsTreeContract::getPKeyId, pkeyId));
@@ -3159,7 +3158,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                             unit.setDateIsComplete(null);
                             unit.setPId(wbsTreeContractRoot.getPKeyId());
                             unit.setAncestorsPId(wbsTreeContractRoot.getAncestorsPId() + "," + wbsTreeContractRoot.getPKeyId());
-                            //baseMapper.insert(unit);
+                            baseMapper.insert(unit);
                             insertList.add(unit);
                             WbsTreeContractList.add(unit);
                         }
@@ -3187,7 +3186,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                             subUnit.setDateIsComplete(null);
                             subUnit.setPId(fatherNode.getPKeyId());
                             subUnit.setAncestorsPId(fatherNode.getAncestorsPId() + "," + fatherNode.getPKeyId());
-                            //baseMapper.insert(subUnit);
+                            baseMapper.insert(subUnit);
                             insertList.add(subUnit);
                             WbsTreeContractList.add(subUnit);
                         }
@@ -3235,7 +3234,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                         division.setDateIsComplete(null);
                                         division.setPId(contract.getPKeyId());
                                         division.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
-                                        //baseMapper.insert(division);
+                                        baseMapper.insert(division);
                                         insertList.add(division);
                                         WbsTreeContractList.add(division);
                                         break;
@@ -3290,7 +3289,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                         subDivision.setDateIsComplete(null);
                                         subDivision.setPId(contract.getPKeyId());
                                         subDivision.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
-                                        //baseMapper.insert(subDivision);
+                                        baseMapper.insert(subDivision);
                                         insertList.add(subDivision);
                                         WbsTreeContractList.add(subDivision);
                                         break;
@@ -3348,7 +3347,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                         item.setDateIsComplete(null);
                                         item.setPId(contract.getPKeyId());
                                         item.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
-                                        //baseMapper.insert(item);
+                                        baseMapper.insert(item);
                                         insertList.add(item);
                                         WbsTreeContractList.add(item);
                                         break;
@@ -3409,7 +3408,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                         subItem.setDateIsComplete(null);
                                         subItem.setPId(contract.getPKeyId());
                                         subItem.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
-                                        //baseMapper.insert(subItem);
+                                        baseMapper.insert(subItem);
                                         insertList.add(subItem);
                                         WbsTreeContractList.add(subItem);
                                         break;
@@ -3432,14 +3431,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                     e.printStackTrace();
                 }
             }
-            boolean b = this.saveBatch(insertList);
-            if(b){
-                bladeRedis.setEx("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), "100",7L);
-                return R.success("新增了" + insertList.size() + "个节点" + "," + String.join(",", updateList) + "节点编号已被修改");
-            }else {
-                bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
-                return R.fail("新增失败");
-            }
+            bladeRedis.setEx("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), "100",7L);
+            return R.success("新增了" + insertList.size() + "个节点" + "," + String.join(",", updateList) + "节点编号已被修改");
         } catch (IOException e) {
             bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
             return R.fail("文件处理失败: " + e.getMessage());