|
@@ -298,33 +298,25 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
LibraryInfo libraryInfoMain = libraryInfoMap.get(addConceptInfoDetailVOMain.getName());
|
|
|
Concept concept = new Concept();
|
|
|
Long conceptId = null;
|
|
|
- int oldlibraryInfoCount = 0;
|
|
|
- boolean isUpdateConcept = false;
|
|
|
if(libraryInfoMain==null){
|
|
|
libraryInfoMain = new LibraryInfo();
|
|
|
BeanUtil.copyProperties(addConceptInfoDetailVOMain, libraryInfoMain);
|
|
|
libraryInfoMain.setGmtCreated(now);
|
|
|
libraryInfoMain.setCreator(currentUser);
|
|
|
- libraryInfoMain.setGmtModified(now);
|
|
|
- libraryInfoMain.setModifier(currentUser);
|
|
|
libraryInfoMain.setType(addConceptInfoVO.getType());
|
|
|
libraryInfoMain.setTypeId(lexicon.getId());
|
|
|
- libraryInfoMain.setConceptId(addConceptInfoVO.getConceptId());
|
|
|
libraryinfoFacade.save(libraryInfoMain);
|
|
|
concept.setLibId(libraryInfoMain.getId());
|
|
|
concept.setGmtCreated(now);
|
|
|
concept.setCreator(currentUser);
|
|
|
- concept.setGmtModified(now);
|
|
|
- concept.setModifier(currentUser);
|
|
|
concept.setId(addConceptInfoVO.getConceptId());
|
|
|
saveOrUpdate(concept);
|
|
|
conceptId = concept.getId();
|
|
|
- libraryInfoMain.setConceptId(conceptId);
|
|
|
}else{
|
|
|
+ int ckConceptId = libraryInfoMain.getConceptId().intValue();
|
|
|
//如果标准词之前作为同义词被其他占用的情况
|
|
|
if(libraryInfoMain.getIsConcept()==0
|
|
|
- &&libraryInfoList.stream().map(i->i.getConceptId()).distinct().count()>1
|
|
|
- &&libraryInfoList.stream().filter(i->i.getIsConcept()==1).count()>=1){
|
|
|
+ &&libraryInfoList.stream().filter(i->i.getConceptId().intValue()==ckConceptId).count()==1){
|
|
|
QueryWrapper<LibraryInfo> libraryInfoQe2 = new QueryWrapper<>();
|
|
|
libraryInfoQe2.eq("is_concept", 1);
|
|
|
libraryInfoQe2.eq("concept_id", libraryInfoMain.getConceptId());
|
|
@@ -336,26 +328,16 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
|
|
|
conceptId = libraryInfoMain.getConceptId();
|
|
|
concept.setId(conceptId);
|
|
|
-
|
|
|
- if(libraryInfoMain.getIsConcept()==0
|
|
|
- ||!(StringUtil.isBlank(libraryInfoMain.getRemark())?"":libraryInfoMain.getRemark()).equals((StringUtil.isBlank(addConceptInfoDetailVOMain.getRemark())?"":addConceptInfoDetailVOMain.getRemark()))){
|
|
|
- concept.setLibId(libraryInfoMain.getId());
|
|
|
- concept.setGmtModified(now);
|
|
|
- concept.setModifier(currentUser);
|
|
|
+ concept.setLibId(libraryInfoMain.getId());
|
|
|
|
|
|
- libraryInfoMain.setIsConcept(1);
|
|
|
- libraryInfoMain.setGmtModified(now);
|
|
|
- libraryInfoMain.setModifier(currentUser);
|
|
|
- libraryInfoMain.setRemark(addConceptInfoDetailVOMain.getRemark());
|
|
|
-
|
|
|
- isUpdateConcept = true;
|
|
|
- }
|
|
|
+ libraryInfoMain.setIsConcept(1);
|
|
|
+ libraryInfoMain.setRemark(addConceptInfoDetailVOMain.getRemark());
|
|
|
}
|
|
|
|
|
|
+ //先删除概念下的同义词,后续再插入
|
|
|
QueryWrapper<LibraryInfo> libraryInfoQe2 = new QueryWrapper<>();
|
|
|
libraryInfoQe2.eq("concept_id", conceptId);
|
|
|
libraryInfoQe2.ne("id", libraryInfoMain.getId());
|
|
|
- oldlibraryInfoCount = libraryinfoFacade.count(libraryInfoQe2);
|
|
|
libraryinfoFacade.remove(libraryInfoQe2);
|
|
|
|
|
|
StringBuffer sbf = new StringBuffer();
|
|
@@ -368,18 +350,13 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
libraryInfo = new LibraryInfo();
|
|
|
libraryInfo.setGmtCreated(now);
|
|
|
libraryInfo.setCreator(currentUser);
|
|
|
- libraryInfo.setGmtModified(now);
|
|
|
- libraryInfo.setModifier(currentUser);
|
|
|
- isUpdateConcept = true;
|
|
|
}else if(libraryInfo.getConceptId().intValue()!=conceptId.intValue()){
|
|
|
sbf.append(i.getName()).append(" ");
|
|
|
continue;
|
|
|
- }else if(!(StringUtil.isBlank(i.getRemark())?"":i.getRemark()).equals((StringUtil.isBlank(libraryInfo.getRemark())?"":libraryInfo.getRemark()))){
|
|
|
- libraryInfo.setGmtModified(now);
|
|
|
- libraryInfo.setModifier(currentUser);
|
|
|
- isUpdateConcept = true;
|
|
|
}
|
|
|
|
|
|
+ libraryInfo.setGmtModified(now);
|
|
|
+ libraryInfo.setModifier(currentUser);
|
|
|
libraryInfo.setName(i.getName());
|
|
|
libraryInfo.setIsConcept(0);
|
|
|
libraryInfo.setRemark(i.getRemark());
|
|
@@ -391,26 +368,22 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,sbf.toString());
|
|
|
}
|
|
|
|
|
|
- //更新前后同义词个数不一样,修改更新时间
|
|
|
- if(oldlibraryInfoCount!=saveOrUpdateLibraryInfoList.size()){
|
|
|
- isUpdateConcept = true;
|
|
|
- }
|
|
|
-
|
|
|
for(LibraryInfo i : saveOrUpdateLibraryInfoList){
|
|
|
i.setId(null);
|
|
|
i.setConceptId(conceptId);
|
|
|
i.setType(addConceptInfoVO.getType());
|
|
|
i.setTypeId(lexicon.getId());
|
|
|
}
|
|
|
+ libraryInfoMain.setConceptId(conceptId);
|
|
|
+ libraryInfoMain.setGmtModified(now);
|
|
|
+ libraryInfoMain.setModifier(currentUser);
|
|
|
saveOrUpdateLibraryInfoList.add(libraryInfoMain);
|
|
|
|
|
|
libraryInfoService.saveOrUpdateBatch(saveOrUpdateLibraryInfoList);
|
|
|
|
|
|
- if(isUpdateConcept){
|
|
|
- concept.setGmtModified(now);
|
|
|
- concept.setModifier(currentUser);
|
|
|
- updateById(concept);
|
|
|
- }
|
|
|
+ concept.setGmtModified(now);
|
|
|
+ concept.setModifier(currentUser);
|
|
|
+ updateById(concept);
|
|
|
|
|
|
return true;
|
|
|
}
|