Sfoglia il codice sorgente

标签从词库检索,过滤已添加的标签

zhoutg 6 anni fa
parent
commit
d087c06cb1

+ 1 - 0
icssman-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -32,6 +32,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/introduceInfo/saveIntroduce").permitAll()
                 .antMatchers("/dictionaryInfo/getList").permitAll()
                 .antMatchers("/getIcssEnumsData").permitAll()
+                .antMatchers("/questionInfo/indexByLexicon").permitAll()
                 .antMatchers("/**").authenticated();
 //                        .antMatchers("/**").permitAll();
 

+ 1 - 0
icssman-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -93,6 +93,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
 //                || matchers("/icssfile/uploadImage", request)
                 || matchers("/getIcssEnumsData", request)
                 || matchers("/dictionaryInfo/getList", request)
+                || matchers("/questionInfo/indexByLexicon", request)
                 || matchers("/", request)) {
             return true;
         }

+ 27 - 0
icssman-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.KnowledgemanServiceClient;
 import com.diagbot.client.UserServiceClient;
+import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.GetQuestionInfoDTO;
 import com.diagbot.dto.QuestionDTO;
 import com.diagbot.dto.QuestionPageDTO;
@@ -37,6 +38,7 @@ import com.diagbot.vo.ConceptExistVO;
 import com.diagbot.vo.DeleteQuestionVO;
 import com.diagbot.vo.GetQuestionIdsByTypeVO;
 import com.diagbot.vo.GetQuestionInfoVO;
+import com.diagbot.vo.IndexLexiconVO;
 import com.diagbot.vo.QuestionIdsVO;
 import com.diagbot.vo.QuestionIndexSubVO;
 import com.diagbot.vo.QuestionIndexVO;
@@ -90,6 +92,8 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
     @Autowired
     CacheFacade cacheFacade;
 
+
+
     /**
      * 标签保存
      *
@@ -385,6 +389,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
                 .eq("tag_name", questionInfo.getTagName())
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("type", questionInfo.getType())
+                .ne("tag_type", TagTypeEnum.T8.getKey())
                 .ne("id", questionInfo.getId() == null ? -1 : questionInfo.getId()));
         if (ListUtil.isNotEmpty(questionInfoList)) { //标签type、tagName唯一
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标签系统名称已重复,无法建立");
@@ -724,4 +729,26 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
             }
         }
     }
+
+
+    public List<ConceptBaseDTO> indexByLexiconFac(IndexLexiconVO indexLexiconVO) {
+        RespDTO<List<ConceptBaseDTO>> res = knowledgemanServiceClient.indexByLexiconFac(indexLexiconVO);
+        RespDTOUtil.respNGDeal(res, "【远程调用】搜索概念失败");
+
+        // 过滤已添加的标签
+        List<QuestionInfo> questionInfoList = this.list(new QueryWrapper<QuestionInfo>()
+                .in("tag_name", res.data.stream().map(row -> row.getName()).collect(Collectors.toList()))
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("type", indexLexiconVO.getType())
+                .ne("tag_type", TagTypeEnum.T8.getKey()));
+        List<String> nameExist = questionInfoList.stream().map(row -> row.getTagName()).collect(Collectors.toList());
+        if (ListUtil.isNotEmpty(nameExist)) {
+            for (int i = 0; i < res.data.size(); i++) {
+                if (nameExist.contains(res.data.get(i).getName())) {
+                    res.data.remove(i--);
+                }
+            }
+        }
+        return res.data;
+    }
 }

+ 2 - 0
icssman-service/src/main/java/com/diagbot/vo/IndexLexiconVO.java

@@ -19,4 +19,6 @@ public class IndexLexiconVO {
     private String name;
     @NotNull(message = "词性类型不能为空")
     private List<Integer> libType;
+    @NotNull(message = "标签所属不能为空")
+    private Integer type;
 }

+ 13 - 0
icssman-service/src/main/java/com/diagbot/web/QuestionInfoController.java

@@ -3,12 +3,14 @@ package com.diagbot.web;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.QuestionDTO;
 import com.diagbot.dto.QuestionPageDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.facade.QuestionFacade;
 import com.diagbot.vo.DeleteQuestionVO;
+import com.diagbot.vo.IndexLexiconVO;
 import com.diagbot.vo.QuestionIdsVO;
 import com.diagbot.vo.QuestionIndexSubVO;
 import com.diagbot.vo.QuestionIndexVO;
@@ -141,4 +143,15 @@ public class QuestionInfoController {
         questionFacade.clearAllCacheByIds(id);
         return RespDTO.onSuc(true);
     }
+
+
+    @ApiOperation(value = "根据名称和术语库词性类型搜索,过滤已添加的标签[by:zhoutg]",
+            notes = "name: 搜索内容,必填<br>" +
+                    "libType:术语库词性类型,必填<br>" +
+                    "type: 标签归属,必填<br>")
+    @PostMapping("/indexByLexicon")
+    @SysLogger("indexByLexicon")
+    public RespDTO<List<ConceptBaseDTO>> indexByLexicon(@RequestBody IndexLexiconVO indexLexiconVO){
+        return RespDTO.onSuc(questionFacade.indexByLexiconFac(indexLexiconVO));
+    }
 }

+ 1 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/IndexLexiconVO.java

@@ -19,4 +19,5 @@ public class IndexLexiconVO {
     private String name;
     @NotNull(message = "词性类型不能为空")
     private List<Integer> libType;
+    private Integer type;
 }