|
@@ -75,32 +75,12 @@ public class RelationFacade extends RelationServiceImpl {
|
|
|
if(ids.size()>0){
|
|
|
RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
- "获取用户信息失败");
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,"获取用户信息失败");
|
|
|
}
|
|
|
ipage.getRecords().forEach(i->{
|
|
|
i.setOperName(respDTO.data.get(i.getOperName()));
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- List<Long> conceptIds = new ArrayList<>();
|
|
|
- conceptIds.addAll(ipage.getRecords().stream().map(i->i.getStartId()).collect(Collectors.toList()));
|
|
|
- conceptIds.addAll(ipage.getRecords().stream().map(i->i.getEndId()).collect(Collectors.toList()));
|
|
|
- conceptIds = conceptIds.stream().distinct().collect(Collectors.toList());
|
|
|
- QueryWrapper<LibraryInfo> libraryInfoQe = new QueryWrapper<LibraryInfo>();
|
|
|
- libraryInfoQe.eq("is_deleted", "N");
|
|
|
- libraryInfoQe.eq("is_concept", 1);
|
|
|
- libraryInfoQe.in("concept_id", conceptIds);
|
|
|
- Map<Long,LibraryInfo> libraryInfoMap = libraryInfoFacade.list(libraryInfoQe).stream().collect(Collectors.toMap(LibraryInfo::getConceptId, i->i));
|
|
|
-
|
|
|
- ipage.getRecords().forEach(i->{
|
|
|
- if(libraryInfoMap.get(i.getStartId())!=null){
|
|
|
- i.setStartType(libraryInfoMap.get(i.getStartId()).getType());
|
|
|
- }
|
|
|
- if(libraryInfoMap.get(i.getEndId())!=null){
|
|
|
- i.setEndType(libraryInfoMap.get(i.getEndId()).getType());
|
|
|
- }
|
|
|
- });
|
|
|
return ipage;
|
|
|
}
|
|
|
|
|
@@ -111,11 +91,19 @@ public class RelationFacade extends RelationServiceImpl {
|
|
|
*/
|
|
|
public Boolean removeRelationInfo(RemoveRelationInfoVO removeRelationInfoVO) {
|
|
|
Relation relation = this.getById(removeRelationInfoVO.getId());
|
|
|
- if(relation==null||relation.getIsDeleted().equals("Y")){
|
|
|
+ if(relation==null){
|
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS);
|
|
|
}
|
|
|
+ if(relation.getIsDeleted().equals(removeRelationInfoVO.getIsDeleted())){
|
|
|
+ if(removeRelationInfoVO.getIsDeleted().equals("Y")){
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,"该数据已删除!");
|
|
|
+ }
|
|
|
+ if(removeRelationInfoVO.getIsDeleted().equals("N")){
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,"该数据已恢复!");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- relation.setIsDeleted("Y");
|
|
|
+ relation.setIsDeleted(removeRelationInfoVO.getIsDeleted());
|
|
|
relation.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
relation.setGmtModified(DateUtil.now());
|
|
|
return updateById(relation);
|
|
@@ -205,12 +193,12 @@ public class RelationFacade extends RelationServiceImpl {
|
|
|
libraryInfoQe1.eq("type", addRelationInfoVO.getStartType());
|
|
|
LibraryInfo startLibraryInfo = libraryInfoFacade.getOne(libraryInfoQe1);
|
|
|
if(startLibraryInfo==null){
|
|
|
- retMap.put("message", "关系起点术语不存在");
|
|
|
+ retMap.put("message", "数据库中无该起始术语");
|
|
|
return retMap;
|
|
|
}
|
|
|
Concept startConcept = conceptFacade.getById(startLibraryInfo.getConceptId());
|
|
|
if(startConcept==null||startConcept.getIsDeleted().equals("Y")||startConcept.getLibId().intValue()!=startLibraryInfo.getId().intValue()){
|
|
|
- retMap.put("message", "关系起点术语不存在");
|
|
|
+ retMap.put("message", "数据库中无该起始术语");
|
|
|
return retMap;
|
|
|
}
|
|
|
|
|
@@ -221,12 +209,12 @@ public class RelationFacade extends RelationServiceImpl {
|
|
|
libraryInfoQe2.eq("type", addRelationInfoVO.getEndType());
|
|
|
LibraryInfo endLibraryInfo = libraryInfoFacade.getOne(libraryInfoQe2);
|
|
|
if(endLibraryInfo==null){
|
|
|
- retMap.put("message", "关系终点术语不存在");
|
|
|
+ retMap.put("message", "数据库中无该终点术语");
|
|
|
return retMap;
|
|
|
}
|
|
|
Concept endConcept = conceptFacade.getById(endLibraryInfo.getConceptId());
|
|
|
if(endConcept==null||endConcept.getIsDeleted().equals("Y")||endConcept.getLibId().intValue()!=endLibraryInfo.getId().intValue()){
|
|
|
- retMap.put("message", "关系终点术语不存在");
|
|
|
+ retMap.put("message", "数据库中无该终点术语");
|
|
|
return retMap;
|
|
|
}
|
|
|
|
|
@@ -235,7 +223,7 @@ public class RelationFacade extends RelationServiceImpl {
|
|
|
lexiconRelationshipQe.eq("name", addRelationInfoVO.getRelationName());
|
|
|
LexiconRelationship lexiconRelationship = lexiconRelationshipFacade.getOne(lexiconRelationshipQe);
|
|
|
if(lexiconRelationship==null){
|
|
|
- retMap.put("message", "术语关系类型不存在");
|
|
|
+ retMap.put("message", "该关系信息在数据库中不存在");
|
|
|
return retMap;
|
|
|
}
|
|
|
|
|
@@ -326,7 +314,7 @@ public class RelationFacade extends RelationServiceImpl {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- addRelationInfoVOList.add(new AddRelationInfoVO(startName,startType,endName,endType,relationName));
|
|
|
+ addRelationInfoVOList.add(new AddRelationInfoVO(startName,startType,endName,endType,relationName,count));
|
|
|
}
|
|
|
} else {
|
|
|
sbf.append("非excel文件无法解析!").append("<br/>");
|
|
@@ -367,7 +355,7 @@ public class RelationFacade extends RelationServiceImpl {
|
|
|
}
|
|
|
|
|
|
if(addRelationInfoVOList.size()==0){
|
|
|
- throw new CommonException(CommonErrorCode.RPC_ERROR,"导入数据不能为空");
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR,"导入数据不能为空!");
|
|
|
}
|
|
|
|
|
|
/****************excel文件中数据存在重复提示---数据一模一样即重复***********************/
|
|
@@ -389,13 +377,11 @@ public class RelationFacade extends RelationServiceImpl {
|
|
|
List<Relation> saveOrUpdateRelationList = new ArrayList<>();
|
|
|
Map<String,Object> ckMap = null;
|
|
|
Object message = null;
|
|
|
- int count = 0;
|
|
|
for(AddRelationInfoVO i : addRelationInfoVOList){
|
|
|
- count++;
|
|
|
ckMap = checkAddRelationInfoVO(i);
|
|
|
message = ckMap.get("message");
|
|
|
if(message!=null){
|
|
|
- sbf.append(message.toString()).append("(第").append(count).append("行)").append("<br/>");
|
|
|
+ sbf.append("第").append(i.getLineNum()).append("行数据有误,").append(message.toString()).append("<br/>");
|
|
|
}else if(ckMap.get("relation")!=null){
|
|
|
saveOrUpdateRelationList.add((Relation)(ckMap.get("relation")));
|
|
|
}
|