|
@@ -807,8 +807,10 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
libraryInfoQe.in("name", addConceptInfoDetailVOList.stream().map(i->i.getName()).distinct().collect(Collectors.toList()));
|
|
|
Map<String,List<LibraryInfo>> libraryInfoListMap = libraryinfoFacade.list(libraryInfoQe).stream().collect(Collectors.groupingBy(LibraryInfo::getName));
|
|
|
|
|
|
+ Map<String,Lexicon> lexiconMap = lexiconFacade.list().stream().collect(Collectors.toMap(Lexicon::getName, i->i));
|
|
|
+
|
|
|
addConceptInfoVOList.forEach(i -> {
|
|
|
- i = checkImConceptInfo(i,libraryInfoListMap);
|
|
|
+ i = checkImConceptInfo(i,libraryInfoListMap,lexiconMap);
|
|
|
});
|
|
|
|
|
|
saveAddConceptInfoVOList(addConceptInfoVOList);
|
|
@@ -820,19 +822,15 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
* 导入数据插入更新前校验
|
|
|
* @param addConceptInfoVO
|
|
|
* @param libraryInfoListAllMap
|
|
|
+ * @param lexiconMap
|
|
|
* @return
|
|
|
*/
|
|
|
- public AddConceptInfoVO checkImConceptInfo(AddConceptInfoVO addConceptInfoVO,Map<String,List<LibraryInfo>> libraryInfoListAllMap) {
|
|
|
+ public AddConceptInfoVO checkImConceptInfo(AddConceptInfoVO addConceptInfoVO,Map<String,List<LibraryInfo>> libraryInfoListAllMap,Map<String,Lexicon> lexiconMap) {
|
|
|
String currentUser = UserUtils.getCurrentPrincipleID();
|
|
|
Date now = DateUtil.now();
|
|
|
|
|
|
Concept concept = new Concept();
|
|
|
- ConceptCommon conceptCommon = new ConceptCommon();
|
|
|
- conceptCommon.setSexType(addConceptInfoVO.getSexType());
|
|
|
- conceptCommon.setMinAge(addConceptInfoVO.getMinAge());
|
|
|
- conceptCommon.setMaxAge(addConceptInfoVO.getMaxAge());
|
|
|
- conceptCommon.setGmtModified(now);
|
|
|
- conceptCommon.setModifier(currentUser);
|
|
|
+ ConceptCommon conceptCommon = null;
|
|
|
List<LibraryInfo> libraryInfoList = Lists.newArrayList();
|
|
|
|
|
|
String lineNumStr = "第" + addConceptInfoVO.getLineNum() + "行";
|
|
@@ -845,14 +843,22 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, lineNumStr + "标准术语只能有一个!");
|
|
|
}
|
|
|
|
|
|
- Integer typeId_ = LexiconTypeEnum.getKey(addConceptInfoVO.getType());
|
|
|
- if (typeId_ == null) {
|
|
|
+ Lexicon lexicon = lexiconMap.get(addConceptInfoVO.getType());
|
|
|
+ if (lexicon == null) {
|
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS, lineNumStr + "数据有误,该类型信息在数据库中不存在!");
|
|
|
}
|
|
|
- Long typeId = typeId_.longValue();
|
|
|
+ Long typeId = lexicon.getId();
|
|
|
concept.setLibType(typeId);
|
|
|
concept.setGmtModified(now);
|
|
|
concept.setModifier(currentUser);
|
|
|
+ if(lexicon.getIsHasCommon()==1){
|
|
|
+ conceptCommon = new ConceptCommon();
|
|
|
+ conceptCommon.setSexType(addConceptInfoVO.getSexType());
|
|
|
+ conceptCommon.setMinAge(addConceptInfoVO.getMinAge());
|
|
|
+ conceptCommon.setMaxAge(addConceptInfoVO.getMaxAge());
|
|
|
+ conceptCommon.setGmtModified(now);
|
|
|
+ conceptCommon.setModifier(currentUser);
|
|
|
+ }
|
|
|
|
|
|
List<LibraryInfo> extLibraryInfoList = Lists.newArrayList();
|
|
|
addConceptInfoVO.getDetailList().forEach(a->{
|
|
@@ -872,8 +878,10 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
conceptId = -9999l;
|
|
|
concept.setGmtCreate(now);
|
|
|
concept.setCreator(currentUser);
|
|
|
- conceptCommon.setGmtCreate(now);
|
|
|
- conceptCommon.setCreator(currentUser);
|
|
|
+ if(conceptCommon!=null){
|
|
|
+ conceptCommon.setGmtCreate(now);
|
|
|
+ conceptCommon.setCreator(currentUser);
|
|
|
+ }
|
|
|
} else {
|
|
|
conceptId = libraryInfoMain.getConceptId();
|
|
|
concept.setId(conceptId);
|
|
@@ -965,11 +973,13 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
conceptCommonQe.in("concept_id", conceptIds);
|
|
|
Map<Long,ConceptCommon> conceptCommonMap = conceptCommonFacade.list(conceptCommonQe).stream().collect(Collectors.toMap(ConceptCommon::getConceptId, i->i));
|
|
|
addConceptInfoVOList.forEach(i->{
|
|
|
- if(i.getConceptId()!=null){
|
|
|
- i.getConceptCommon().setId(conceptCommonMap.get(i.getConceptId()).getId());
|
|
|
+ if(i.getConceptCommon()!=null){
|
|
|
+ if(i.getConceptId()!=null){
|
|
|
+ i.getConceptCommon().setId(conceptCommonMap.get(i.getConceptId()).getId());
|
|
|
+ }
|
|
|
+ i.getConceptCommon().setConceptId(i.getConcept().getId());
|
|
|
+ saveOrUpdateConceptCommonList.add(i.getConceptCommon());
|
|
|
}
|
|
|
- i.getConceptCommon().setConceptId(i.getConcept().getId());
|
|
|
- saveOrUpdateConceptCommonList.add(i.getConceptCommon());
|
|
|
});
|
|
|
conceptCommonService.saveOrUpdateBatch(saveOrUpdateConceptCommonList);
|
|
|
}
|