zhoutg 6 лет назад
Родитель
Сommit
12ba308cc7

+ 1 - 1
icssman-service/src/main/java/com/diagbot/client/KnowledgemanServiceClient.java

@@ -26,7 +26,7 @@ public interface KnowledgemanServiceClient {
     RespDTO<List<ConceptBaseDTO>> index(@RequestBody IndexVO indexVO);
 
     @PostMapping("/commonconcept/getConceptMapByNameAndType")
-    RespDTO<Map<String, Long>> getConceptMap(@RequestBody ConceptExistVO conceptExistVO);
+    RespDTO<Map<String, List<Integer>>> getConceptMap(@RequestBody ConceptExistVO conceptExistVO);
 
     /**
      * 根据概念Id列表获取概念列表Map

+ 1 - 2
icssman-service/src/main/java/com/diagbot/client/hystrix/KnowledgemanServiceHystrix.java

@@ -9,7 +9,6 @@ import com.diagbot.vo.ConceptTypeVO;
 import com.diagbot.vo.IndexVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
@@ -31,7 +30,7 @@ public class KnowledgemanServiceHystrix implements KnowledgemanServiceClient {
     }
 
     @Override
-    public RespDTO<Map<String, Long>> getConceptMap(ConceptExistVO conceptExistVO) {
+    public RespDTO<Map<String, List<Integer>>> getConceptMap(ConceptExistVO conceptExistVO) {
         log.error("【hystrix】调用{}异常", "getConceptMap");
         return null;
     }

+ 2 - 2
icssman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -31,8 +31,8 @@ public class ConceptFacade extends DisTypeServiceImpl {
     }
 
 
-    public Map<String, Long> getConceptMap(ConceptExistVO conceptExistVO){
-        RespDTO<Map<String, Long>> res = knowledgemanServiceClient.getConceptMap(conceptExistVO);
+    public Map<String, List<Integer>> getConceptMap(ConceptExistVO conceptExistVO){
+        RespDTO<Map<String, List<Integer>>> res = knowledgemanServiceClient.getConceptMap(conceptExistVO);
         RespDTOUtil.respNGDeal(res, "远程调用获取概念列表失败");
         return res.data;
     }

+ 20 - 17
icssman-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -39,8 +39,10 @@ import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
+import com.diagbot.vo.ConceptExistVO;
 import com.diagbot.vo.DeleteQuestionVO;
 import com.diagbot.vo.GetQuestionIdsByTypeVO;
 import com.diagbot.vo.GetQuestionInfoVO;
@@ -436,23 +438,24 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
             bean.setModifier(mapRespDTO.data.get(bean.getModifier()));
         }
 
-        //TODO 待修改
-//        List<String> nameList = res.getRecords().stream().map(row -> row.getTagName()).collect(Collectors.toList());
-//        ConceptExistVO conceptExistVO = new ConceptExistVO();
-//        conceptExistVO.setNameList(nameList);
-//        conceptExistVO.setType(res.getRecords().get(0).getType());
-//        try {
-//            RespDTO<Map<String, Long>> resMap = knowledgemanServiceClient.getConceptMap(conceptExistVO);
-//            RespDTOUtil.respNGDeal(resMap, "远程调用根据名称和类型获取概念列表失败");
-//            Map<String, Long> map = resMap.data;
-//            for (QuestionPageDTO bean :  res.getRecords()) {
-//                if(map.get(bean.getTagName()) != null) {
-//                    bean.setExist(true);
-//                }
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
+        List<String> nameList = res.getRecords().stream().map(row -> row.getTagName()).collect(Collectors.toList());
+        ConceptExistVO conceptExistVO = new ConceptExistVO();
+        conceptExistVO.setNameList(nameList);
+        try {
+            RespDTO<Map<String, List<Integer>>> resMap = knowledgemanServiceClient.getConceptMap(conceptExistVO);
+            RespDTOUtil.respNGDeal(resMap, "远程调用根据名称和类型获取概念列表失败");
+            Map<String, List<Integer>> map = resMap.data;
+            for (QuestionPageDTO bean : res.getRecords()) {
+                List<Integer> list = map.get(bean.getTagName());
+                if (ListUtil.isNotEmpty(list)) {
+                    if (list.contains(bean.getType())) {
+                        bean.setExist(true);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return res;
     }
 

+ 14 - 7
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -26,6 +26,7 @@ import com.diagbot.service.LibraryInfoService;
 import com.diagbot.service.impl.ConceptServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
 import com.diagbot.util.IntegerUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ParamConvertUtil;
@@ -757,7 +758,7 @@ public class ConceptFacade extends ConceptServiceImpl {
      * @param conceptExistVO 搜索参数
      * @return 术语id和术语 Map
      */
-    public Map<String, Long> getConceptMap(ConceptExistVO conceptExistVO) {
+    public Map<String, List<Integer>> getConceptMap(ConceptExistVO conceptExistVO) {
         // 入参验证
         if (ListUtil.isEmpty(conceptExistVO.getNameList())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "名称列表不能为空");
@@ -774,13 +775,19 @@ public class ConceptFacade extends ConceptServiceImpl {
         //获取结构
         List<Concept> concepts
                 = this.getListByNamesAndType(conceptExistVO.getNameList(), conceptExistVO.getLibType());
-
-        //出参封装
-        Map<String, Long> map = new HashMap<>();
-        if (ListUtil.isNotEmpty(concepts)) {
-            map = concepts.stream().collect(Collectors.toMap(r -> r.getLibName(), r -> r.getId()));
+        Map<String, List<Concept>> map1 = EntityUtil.makeEntityListMap(concepts, "libName");
+        Map<String, List<Integer>> typeMap = new HashMap<>();
+        for(String key : map1.keySet()) {
+            List<Concept> list = map1.get(key);
+            List<Integer> typeList = new ArrayList<>();
+            if (ListUtil.isNotEmpty(list)) {
+                for (Concept c : list) {
+                    typeList.add(ParamConvertUtil.libConvert2Concept(c.getLibType().intValue()));
+                }
+                typeMap.put(key, typeList);
+            }
         }
-        return map;
+        return typeMap;
     }
 
 

+ 1 - 1
knowledgeman-service/src/main/java/com/diagbot/web/CommonConceptController.java

@@ -45,7 +45,7 @@ public class CommonConceptController {
                     "type: 类型")
     @PostMapping("/getConceptMapByNameAndType")
     @SysLogger("getConceptMapByNameAndType")
-    public RespDTO<Map<String, Long>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO){
+    public RespDTO<Map<String, List<Integer>>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO){
         return RespDTO.onSuc(conceptFacade.getConceptMap(conceptExistVO));
     }