浏览代码

医学术语导入修改

rgb 6 年之前
父节点
当前提交
060ee5818c
共有 1 个文件被更改,包括 22 次插入9 次删除
  1. 22 9
      knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

+ 22 - 9
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -46,6 +46,8 @@ import com.diagbot.enums.LexiconRSTypeEnum;
 import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.service.ConceptCommonService;
+import com.diagbot.service.ConceptService;
 import com.diagbot.service.LibraryInfoService;
 import com.diagbot.service.impl.ConceptServiceImpl;
 import com.diagbot.util.BeanUtil;
@@ -91,6 +93,12 @@ public class ConceptFacade extends ConceptServiceImpl {
     @Qualifier("libraryInfoServiceImpl")
     private LibraryInfoService libraryInfoService;
     @Autowired
+    @Qualifier("conceptServiceImpl")
+    private ConceptService conceptService;
+    @Autowired
+    @Qualifier("conceptCommonServiceImpl")
+    private ConceptCommonService conceptCommonService;
+    @Autowired
     private UserServiceClient userServiceClient;
     @Autowired
     private LexiconFacade lexiconFacade;
@@ -870,7 +878,7 @@ public class ConceptFacade extends ConceptServiceImpl {
             concept.setId(conceptId);
             addConceptInfoVO.setConceptId(conceptId);
 
-            if (libraryInfoMain.getIsConcept()!=1&&extLibraryInfoList.stream().filter(i -> i.getConceptId() == libraryInfoMain.getConceptId()).count() == 1) {
+            if (libraryInfoMain.getIsConcept()!=1&&extLibraryInfoList.stream().filter(i -> i.getConceptId().intValue() == libraryInfoMain.getConceptId().intValue()).count() == 1) {
             	throw new CommonException(CommonErrorCode.RPC_ERROR, lineNumStr + "标准术语已作为同义词被占用!");
             }
         }
@@ -890,6 +898,7 @@ public class ConceptFacade extends ConceptServiceImpl {
 
             BeanUtil.copyProperties(i, libraryInfo);
             libraryInfo.setId(null);
+            libraryInfo.setConceptId(conceptId);
             libraryInfo.setGmtModified(now);
             libraryInfo.setModifier(currentUser);
             if(i.getIsConcept()==1){
@@ -917,16 +926,17 @@ public class ConceptFacade extends ConceptServiceImpl {
      */
     private void saveAddConceptInfoVOList(List<AddConceptInfoVO> addConceptInfoVOList){
     	List<Long> conceptIds = addConceptInfoVOList.stream().filter(i->i.getConceptId()!=null).map(i->i.getConceptId()).collect(Collectors.toList());
-    	
-        QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<>();
-        libraryInfoQe.in("concept_id", conceptIds);
-        libraryinfoFacade.remove(libraryInfoQe);
+    	if(ListUtil.isNotEmpty(conceptIds)){
+    		QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<>();
+            libraryInfoQe.in("concept_id", conceptIds);
+            libraryinfoFacade.remove(libraryInfoQe);
+    	}
         
         List<LibraryInfo> saveLibraryInfoList = Lists.newArrayList();
         addConceptInfoVOList.forEach(i->{
         	saveLibraryInfoList.addAll(i.getLibraryInfoList());
         });
-        libraryinfoFacade.saveBatch(saveLibraryInfoList);
+        libraryInfoService.saveBatch(saveLibraryInfoList);
         
         List<Concept> saveOrUpdateConceptList = Lists.newArrayList();
         addConceptInfoVOList.forEach(i->{
@@ -934,7 +944,7 @@ public class ConceptFacade extends ConceptServiceImpl {
         	i.getConcept().setLibName(i.getLibraryInfoList().get(0).getName());
         	saveOrUpdateConceptList.add(i.getConcept());
         });
-        saveOrUpdateBatch(saveOrUpdateConceptList);
+        conceptService.saveOrUpdateBatch(saveOrUpdateConceptList);
         
         List<LibraryInfo> updateLibraryInfoList = Lists.newArrayList();
         addConceptInfoVOList.forEach(i->{
@@ -945,7 +955,9 @@ public class ConceptFacade extends ConceptServiceImpl {
         		updateLibraryInfoList.addAll(i.getLibraryInfoList());
         	}
         });
-        libraryinfoFacade.updateBatchById(updateLibraryInfoList);
+        if(ListUtil.isNotEmpty(updateLibraryInfoList)){
+        	libraryInfoService.updateBatchById(updateLibraryInfoList);
+        }
         
         List<ConceptCommon> saveOrUpdateConceptCommonList = Lists.newArrayList();
         QueryWrapper<ConceptCommon> conceptCommonQe = new QueryWrapper<>();
@@ -955,9 +967,10 @@ public class ConceptFacade extends ConceptServiceImpl {
         	if(i.getConceptId()!=null){
         		i.getConceptCommon().setId(conceptCommonMap.get(i.getConceptId()).getId());
         	}
+        	i.getConceptCommon().setConceptId(i.getConcept().getId());
         	saveOrUpdateConceptCommonList.add(i.getConceptCommon());
         });
-        conceptCommonFacade.saveOrUpdateBatch(saveOrUpdateConceptCommonList);
+        conceptCommonService.saveOrUpdateBatch(saveOrUpdateConceptCommonList);
     }
     
     @SuppressWarnings("deprecation")