|
@@ -3,13 +3,18 @@ package com.diagbot.facade;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import com.diagbot.client.UserServiceClient;
|
|
|
|
+import com.diagbot.dto.IntroducePageDTO;
|
|
|
|
+import com.diagbot.dto.QuestionIntroduceDTO;
|
|
|
|
+import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.entity.IntroduceDetail;
|
|
import com.diagbot.entity.IntroduceDetail;
|
|
import com.diagbot.entity.IntroduceInfo;
|
|
import com.diagbot.entity.IntroduceInfo;
|
|
import com.diagbot.entity.IntroduceMap;
|
|
import com.diagbot.entity.IntroduceMap;
|
|
|
|
+import com.diagbot.entity.QuestionInfo;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
-import com.diagbot.service.impl.IntroduceDetailServiceImpl;
|
|
|
|
|
|
+import com.diagbot.service.IntroduceDetailService;
|
|
|
|
+import com.diagbot.service.IntroduceMapService;
|
|
import com.diagbot.service.impl.IntroduceInfoServiceImpl;
|
|
import com.diagbot.service.impl.IntroduceInfoServiceImpl;
|
|
-import com.diagbot.service.impl.IntroduceMapServiceImpl;
|
|
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.util.UserUtils;
|
|
@@ -19,10 +24,12 @@ import com.diagbot.vo.IntroducePageVO;
|
|
import com.diagbot.vo.IntroduceVO;
|
|
import com.diagbot.vo.IntroduceVO;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description:
|
|
* @Description:
|
|
@@ -36,9 +43,15 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
@Autowired
|
|
@Autowired
|
|
IntroduceDetailFacade introduceDetailFacade;
|
|
IntroduceDetailFacade introduceDetailFacade;
|
|
@Autowired
|
|
@Autowired
|
|
- IntroduceDetailServiceImpl introduceDetailServiceImpl;
|
|
|
|
|
|
+ @Qualifier("introduceDetailServiceImpl")
|
|
|
|
+ IntroduceDetailService introduceDetailService;
|
|
@Autowired
|
|
@Autowired
|
|
- IntroduceMapServiceImpl introduceMapServiceImpl;
|
|
|
|
|
|
+ @Qualifier("introduceMapServiceImpl")
|
|
|
|
+ IntroduceMapService introduceMapService;
|
|
|
|
+ @Autowired
|
|
|
|
+ UserServiceClient userServiceClient;
|
|
|
|
+ @Autowired
|
|
|
|
+ QuestionInfoFacade questionInfoFacade;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 保存提示信息(新增or修改)
|
|
* 保存提示信息(新增or修改)
|
|
@@ -52,10 +65,9 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
introduceInfo = this.getById(introduceVO.getId());
|
|
introduceInfo = this.getById(introduceVO.getId());
|
|
introduceInfo.setModifier(UserUtils.getCurrentPrincipleID());
|
|
introduceInfo.setModifier(UserUtils.getCurrentPrincipleID());
|
|
introduceInfo.setGmtModified(DateUtil.now());
|
|
introduceInfo.setGmtModified(DateUtil.now());
|
|
- } else {
|
|
|
|
- introduceInfo.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
|
- introduceInfo.setGmtCreate(DateUtil.now());
|
|
|
|
}
|
|
}
|
|
|
|
+ introduceInfo.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
|
+ introduceInfo.setGmtCreate(DateUtil.now());
|
|
introduceInfo.setName(introduceVO.getName());
|
|
introduceInfo.setName(introduceVO.getName());
|
|
introduceInfo.setRemark(introduceVO.getRemark());
|
|
introduceInfo.setRemark(introduceVO.getRemark());
|
|
|
|
|
|
@@ -88,7 +100,7 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
introduceDetailList.add(detail);
|
|
introduceDetailList.add(detail);
|
|
}
|
|
}
|
|
//插入新的明细记录
|
|
//插入新的明细记录
|
|
- introduceDetailServiceImpl.saveBatch(introduceDetailList);
|
|
|
|
|
|
+ introduceDetailService.saveBatch(introduceDetailList);
|
|
|
|
|
|
//更新映射关系
|
|
//更新映射关系
|
|
//删除已有映射关系
|
|
//删除已有映射关系
|
|
@@ -107,7 +119,7 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
introduceMap.setIntroduceId(introduceInfo.getId());
|
|
introduceMap.setIntroduceId(introduceInfo.getId());
|
|
introduceMapList.add(introduceMap);
|
|
introduceMapList.add(introduceMap);
|
|
}
|
|
}
|
|
- introduceMapServiceImpl.saveBatch(introduceMapList);
|
|
|
|
|
|
+ introduceMapService.saveBatch(introduceMapList);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -180,18 +192,35 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 分页查询提示信息,可带等于条件
|
|
|
|
|
|
+ * 获取提示信息分页信息,带条件
|
|
*
|
|
*
|
|
* @param introducePageVO
|
|
* @param introducePageVO
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public IPage<IntroduceInfo> getPageByMap(IntroducePageVO introducePageVO) {
|
|
|
|
- QueryWrapper<IntroduceInfo> introduceInfoQueryWrapper = new QueryWrapper<>();
|
|
|
|
- for (Map.Entry<String, Object> entry : introducePageVO.getMap().entrySet()) {
|
|
|
|
- introduceInfoQueryWrapper.eq(entry.getKey(), entry.getValue());
|
|
|
|
|
|
+ public IPage<IntroducePageDTO> getIntroducePageByMap(IntroducePageVO introducePageVO) {
|
|
|
|
+ IPage<IntroducePageDTO> introducePageDTOIPage = this.getIntroducePage(introducePageVO);
|
|
|
|
+ List<IntroducePageDTO> records = introducePageDTOIPage.getRecords();
|
|
|
|
+ for (IntroducePageDTO introducePageDTO : records) {
|
|
|
|
+ if (introducePageDTO.getGmtModified().after(introducePageDTO.getGmtCreate())) {
|
|
|
|
+ introducePageDTO.setOperator(introducePageDTO.getModifier());
|
|
|
|
+ introducePageDTO.setGmtOperate(introducePageDTO.getGmtModified());
|
|
|
|
+ } else {
|
|
|
|
+ introducePageDTO.setOperator(introducePageDTO.getCreator());
|
|
|
|
+ introducePageDTO.setGmtOperate(introducePageDTO.getGmtCreate());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- IPage<IntroduceInfo> introduceInfoIPage = this.page(introducePageVO, introduceInfoQueryWrapper);
|
|
|
|
- return introduceInfoIPage;
|
|
|
|
|
|
+ List<String> userIds = records.stream().map(introduceList -> introduceList.getOperator()).collect(Collectors.toList());
|
|
|
|
+ RespDTO<Map<String, String>> userInfos = userServiceClient.getUserInfoByIds(userIds);
|
|
|
|
+ if (userInfos != null) {
|
|
|
|
+ Map<String, String> userInfoMap = userInfos.data;
|
|
|
|
+ for (IntroducePageDTO introducePageDTO : records) {
|
|
|
|
+ if (userInfoMap.containsKey(introducePageDTO.getOperator())) {
|
|
|
|
+ introducePageDTO.setOperatorName(userInfoMap.get(introducePageDTO.getOperator()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ introducePageDTOIPage.setRecords(records);
|
|
|
|
+ return introducePageDTOIPage;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -207,4 +236,71 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
}
|
|
}
|
|
return this.list(introduceInfoQueryWrapper);
|
|
return this.list(introduceInfoQueryWrapper);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据id获取提示信息
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public IntroducePageDTO getIntroduceById(Long id) {
|
|
|
|
+ IntroducePageDTO introducePageDTO = new IntroducePageDTO();
|
|
|
|
+ IntroduceInfo introduceInfo = this.getById(id);
|
|
|
|
+ BeanUtil.copyProperties(introduceInfo, introducePageDTO);
|
|
|
|
+
|
|
|
|
+ QueryWrapper<IntroduceMap> introduceMapQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ introduceMapQueryWrapper.eq("introduce_id", id).eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ List<IntroduceMap> introduceMapList = introduceMapFacade.list(introduceMapQueryWrapper);
|
|
|
|
+
|
|
|
|
+ List<Long> questionIds = introduceMapList.stream().map(introduceMap -> introduceMap.getQuestionId()).collect(Collectors.toList());
|
|
|
|
+ QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ questionInfoQueryWrapper.in("id", questionIds).eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ List<QuestionInfo> questionInfoList = questionInfoFacade.list(questionInfoQueryWrapper);
|
|
|
|
+
|
|
|
|
+ List<QuestionIntroduceDTO> questionIntroduceDTOList = Lists.newLinkedList();
|
|
|
|
+ String tagName = "";
|
|
|
|
+ for (QuestionInfo questionInfo : questionInfoList) {
|
|
|
|
+ QuestionIntroduceDTO questionIntroduceDTO = new QuestionIntroduceDTO();
|
|
|
|
+ BeanUtil.copyProperties(questionInfo, questionIntroduceDTO);
|
|
|
|
+ questionIntroduceDTOList.add(questionIntroduceDTO);
|
|
|
|
+ tagName += questionInfo.getTagName() + ",";
|
|
|
|
+ }
|
|
|
|
+ if (tagName.endsWith(",")) {
|
|
|
|
+ tagName = tagName.substring(0, tagName.length() - 1);
|
|
|
|
+ }
|
|
|
|
+ introducePageDTO.setTagName(tagName);
|
|
|
|
+ introducePageDTO.setQuestionList(questionIntroduceDTOList);
|
|
|
|
+
|
|
|
|
+ //未关联的标签
|
|
|
|
+ QueryWrapper<QuestionInfo> unRelatedQuestionWrapper = new QueryWrapper<>();
|
|
|
|
+ unRelatedQuestionWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).notIn("id", questionIds);
|
|
|
|
+ List<QuestionInfo> unRelatedQuestionList = questionInfoFacade.list(unRelatedQuestionWrapper);
|
|
|
|
+ List<QuestionIntroduceDTO> unRelatedQuestionDTOList = Lists.newLinkedList();
|
|
|
|
+ for (QuestionInfo questionInfo : unRelatedQuestionList) {
|
|
|
|
+ QuestionIntroduceDTO questionIntroduceDTO = new QuestionIntroduceDTO();
|
|
|
|
+ BeanUtil.copyProperties(questionInfo, questionIntroduceDTO);
|
|
|
|
+ unRelatedQuestionDTOList.add(questionIntroduceDTO);
|
|
|
|
+ }
|
|
|
|
+ introducePageDTO.setUnRelatedQuestionList(unRelatedQuestionDTOList);
|
|
|
|
+
|
|
|
|
+ return introducePageDTO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取未关联标签列表
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<QuestionIntroduceDTO> getAllQuestionList() {
|
|
|
|
+ QueryWrapper<QuestionInfo> unRelatedQuestionWrapper = new QueryWrapper<>();
|
|
|
|
+ unRelatedQuestionWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ List<QuestionInfo> unRelatedQuestionList = questionInfoFacade.list(unRelatedQuestionWrapper);
|
|
|
|
+ List<QuestionIntroduceDTO> unRelatedQuestionDTOList = Lists.newLinkedList();
|
|
|
|
+ for (QuestionInfo questionInfo : unRelatedQuestionList) {
|
|
|
|
+ QuestionIntroduceDTO questionIntroduceDTO = new QuestionIntroduceDTO();
|
|
|
|
+ BeanUtil.copyProperties(questionInfo, questionIntroduceDTO);
|
|
|
|
+ unRelatedQuestionDTOList.add(questionIntroduceDTO);
|
|
|
|
+ }
|
|
|
|
+ return unRelatedQuestionDTOList;
|
|
|
|
+ }
|
|
}
|
|
}
|