Sfoglia il codice sorgente

导入划分时新增出错

cr 1 mese fa
parent
commit
ab9324909d

+ 6 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -4599,6 +4599,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         List<WbsTreeContract> wbsTreeContractList = new ArrayList<>();
         int totalCount = 0;
         int successCount = 0;
+        Map<Long, String>map=new HashMap<>();
         try (InputStream inputStream = file.getInputStream();
              XSSFWorkbook workbook = new XSSFWorkbook(inputStream)) {
 
@@ -4622,13 +4623,16 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         if (isValidCell(pkeyCell) && isValidCell(codeCell)) {
                             String pkeyId = getCellValue(pkeyCell);
                             String partitionCode = getCellValue(codeCell);
-
+                            if(map.containsKey(Long.parseLong(pkeyId))){
+                                continue;
+                            }
                             if (StringUtils.isNotBlank(pkeyId) && StringUtils.isNotBlank(partitionCode)) {
                                 totalCount++;
                                 WbsTreeContract wbsTreeContract = new WbsTreeContract();
                                 wbsTreeContract.setPKeyId(Long.parseLong(pkeyId.trim()));
                                 wbsTreeContract.setPartitionCode(partitionCode.trim());
                                 wbsTreeContractList.add(wbsTreeContract);
+                                map.put(wbsTreeContract.getPKeyId(),wbsTreeContract.getPartitionCode());
                                 successCount++;
                             }
                         }
@@ -4653,6 +4657,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         return R.status(false);
     }
 
+
     @Override
     public Boolean getIsImport(Long projectId, Long contractId) {
         Object o = bladeRedis.get("import:projectId:" + projectId + "contractId:" + contractId);