소스 검색

Merge branch 'dev/diagbotcloud20190918_vital' into dev/diagbotcloud20190924_diagnose2

gaodm 5 년 전
부모
커밋
530b6451e9

+ 14 - 10
knowledgeman-service/src/main/java/com/diagbot/facade/MultContactFacade.java

@@ -8,6 +8,7 @@ import com.diagbot.enums.LexiconTypeEnum;
 import com.diagbot.service.impl.RelationServiceImpl;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.OnlyByRootListVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -38,16 +39,19 @@ public class MultContactFacade extends RelationServiceImpl {
 
         if (ListUtil.isNotEmpty(ipage.getRecords())) {
             List<String> userIds = ipage.getRecords()
-					.stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
-            RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
-            RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
-
-            ipage.getRecords().forEach(i -> {
-                i.setOperName(respDTO.data.get(i.getOperName()));
-                i.setLibType(LexiconTypeEnum.getName(i.getLibTypeId().intValue()));
-                i.setLibNameType(i.getLibName() + "(" + i.getLibType() + ")");
-
-            });
+                    .stream().filter(i -> StringUtil.isNotBlank(i.getOperName()))
+                    .map(i -> i.getOperName()).distinct().collect(Collectors.toList());
+
+            if (ListUtil.isNotEmpty(userIds)) {
+                RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
+                RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
+
+                ipage.getRecords().forEach(i -> {
+                    i.setOperName(respDTO.data.get(i.getOperName()));
+                    i.setLibType(LexiconTypeEnum.getName(i.getLibTypeId().intValue()));
+                    i.setLibNameType(i.getLibName() + "(" + i.getLibType() + ")");
+                });
+            }
         }
 
         return ipage;

+ 7 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/OnlyByRootListVO.java

@@ -41,6 +41,13 @@ public class OnlyByRootListVO extends Page {
     @ApiModelProperty(value="关系类型id")
     private Long relationId;
 
+    /**
+     * 仅有根时是否列出,1-是,0-否
+     */
+    @ApiModelProperty(value="仅有根时是否列出,1-是,0-否")
+    private Integer isOnlyHasRoot = 1;
+
+
     
     
 }

+ 46 - 2
knowledgeman-service/src/main/resources/mapper/RelationMapper.xml

@@ -143,7 +143,7 @@
     </select>
     
     <select id="onlyByRootList" resultType="com.diagbot.dto.OnlyByRootListDTO">
-    	SELECT
+    	<!--SELECT
 		c.id AS conceptId,
 		c.lib_name AS libName,
 		c.lib_type AS libTypeId,
@@ -171,7 +171,51 @@
 		LEFT JOIN kl_relation_order e ON a.id=e.t_relation_id
 		WHERE b.end_id IS NULL
 		GROUP BY c.id
-		ORDER BY operTime DESC
+		ORDER BY operTime DESC-->
+		SELECT
+			t2.id AS conceptId,
+			t2.lib_name AS libName,
+			t2.lib_type AS libTypeId,
+			GROUP_CONCAT(t3.lib_name ORDER BY t1.order_no ASC) AS otherNames,
+			t1.modifier AS operName,
+			t1.gmt_modified AS operTime,
+			t1.is_deleted AS isDeleted
+		FROM
+		(
+		SELECT
+		a.*,c.order_no
+		FROM
+		(SELECT id,is_deleted,gmt_modified,modifier,start_id,end_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') a
+		LEFT JOIN
+		(SELECT end_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') b
+		ON a.start_id=b.end_id
+		LEFT JOIN kl_relation_order c ON a.id=c.t_relation_id
+		WHERE b.end_id IS NULL
+		) t1
+		<if test="isOnlyHasRoot==1">
+			RIGHT
+		</if>
+		JOIN
+		(
+		SELECT id,lib_name,lib_type
+		FROM kl_concept
+		WHERE is_deleted='N'
+		AND lib_type in
+		<foreach collection="startTypeIds" open="(" close=")" separator="," item="startTypeId">
+			#{startTypeId}
+		</foreach>
+		<if test="name!=null and name!=''">
+			AND lib_name LIKE CONCAT("%",#{name},"%")
+		</if>
+		) t2
+		ON t1.start_id=t2.id
+		<if test="isOnlyHasRoot==1">
+			LEFT
+		</if>
+		JOIN
+		kl_concept t3 ON t1.end_id=t3.id
+		GROUP BY t2.id
+		ORDER BY t1.gmt_modified DESC,t2.id DESC
     </select>
     
     

+ 16 - 10
precman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java

@@ -90,19 +90,25 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
                 textList.add(addModuleDetailVO.getText());
             }
         }
-        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
-        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("tag_type", TagTypeEnum.T8.getKey())
-                .eq("type", addModuleInfoVO.getTextType())
-                .in("name", textList);
-        List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+
         //将标签id放入map
         Map<String, Long> questionIdMap = new HashMap<>();
-        for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModuleDetail()) {
-            if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
-                questionIdMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getTagName, questionInfo -> questionInfo.getId()));
+        if(ListUtil.isNotEmpty(textList)){
+            QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+            questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("tag_type", TagTypeEnum.T8.getKey())
+                    .eq("type", addModuleInfoVO.getTextType())
+                    .in("name", textList);
+            List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+
+            for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModuleDetail()) {
+                if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
+                    questionIdMap = questionInfoList.stream()
+                            .collect(Collectors.toMap(QuestionInfo::getTagName, questionInfo -> questionInfo.getId()));
+                }
             }
         }
+
         QuestionInfo addquestionInfo = null;
         List<QuestionInfo> addQuestionInfoList = new ArrayList<>();
         List<String> textExistList = new ArrayList<>();
@@ -131,7 +137,7 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
         questionInfoService.saveBatch(addQuestionInfoList);
         //查询自定义标签的id
         QueryWrapper<QuestionInfo> questionInfoQueryWrapper1 = new QueryWrapper<>();
-        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+        questionInfoQueryWrapper1.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("type", addModuleInfoVO.getTextType())
                 .eq("tag_type", TagTypeEnum.T8.getKey());
         List<QuestionInfo> questionInfoList1 = questionFacade.list(questionInfoQueryWrapper1);

+ 4 - 2
user-service/src/main/java/com/diagbot/facade/UserFacade.java

@@ -968,7 +968,8 @@ public class UserFacade extends UserServiceImpl {
         map.put("modifier", UserUtils.getCurrentPrincipleID());
         map.put("gmtModified", DateUtil.now());
         User userDate = getById(baseIdVO.getId());
-        if (userDate.getIsDeleted().equals("Y")) {
+        if ((null == userDate)
+                || (null != userDate && IsDeleteEnum.Y.getKey().equals(userDate.getIsDeleted()))) {
             return RespDTO.onError("该用户已不存在");
         }
         //客户中心-查询用户续费数量
@@ -1410,7 +1411,8 @@ public class UserFacade extends UserServiceImpl {
         amendUserInfo.put("position", amendUserInfoVO.getPosition());
         amendUserInfo.put("linkman", amendUserInfoVO.getLinkman());
         User userDate = getById(amendUserInfoVO.getUserId());
-        if (userDate.getIsDeleted().equals("Y")) {
+        if ((null == userDate)
+                || (null != userDate && IsDeleteEnum.Y.getKey().equals(userDate.getIsDeleted()))) {
             return RespDTO.onError("该用户已不存在");
         }
         boolean res = updateUserInfo(amendUserInfo);