|
@@ -1,18 +1,8 @@
|
|
package com.diagbot.facade;
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
|
-
|
|
|
|
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.diagbot.client.UserServiceClient;
|
|
import com.diagbot.client.UserServiceClient;
|
|
import com.diagbot.dto.DiseaseInfoDTO;
|
|
import com.diagbot.dto.DiseaseInfoDTO;
|
|
import com.diagbot.dto.IndexConfigAllDTO;
|
|
import com.diagbot.dto.IndexConfigAllDTO;
|
|
@@ -27,12 +17,22 @@ import com.diagbot.service.impl.IndexConfigServiceImpl;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.vo.DiseaseNameVO;
|
|
import com.diagbot.vo.DiseaseNameVO;
|
|
import com.diagbot.vo.IndexConfigDiseaseIdVO;
|
|
import com.diagbot.vo.IndexConfigDiseaseIdVO;
|
|
import com.diagbot.vo.IndexConfigDiseaseNameVO;
|
|
import com.diagbot.vo.IndexConfigDiseaseNameVO;
|
|
import com.diagbot.vo.IndexConfigListVO;
|
|
import com.diagbot.vo.IndexConfigListVO;
|
|
import com.diagbot.vo.IndexConfigVO;
|
|
import com.diagbot.vo.IndexConfigVO;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author wangfeng
|
|
* @author wangfeng
|
|
@@ -43,24 +43,24 @@ import com.diagbot.vo.IndexConfigVO;
|
|
public class IndexConfigFacade extends IndexConfigServiceImpl {
|
|
public class IndexConfigFacade extends IndexConfigServiceImpl {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ @Qualifier("indexConfigServiceImpl")
|
|
IndexConfigService indexConfigService;
|
|
IndexConfigService indexConfigService;
|
|
@Autowired
|
|
@Autowired
|
|
UserServiceClient userServiceClient;
|
|
UserServiceClient userServiceClient;
|
|
/**
|
|
/**
|
|
- *
|
|
|
|
- * @param page
|
|
|
|
|
|
+ *
|
|
* @param indexConfigDiseaseNameVO
|
|
* @param indexConfigDiseaseNameVO
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public IPage<IndexConfigDTO> queryIndexConfigPage(IndexConfigDiseaseNameVO indexConfigDiseaseNameVO) {
|
|
public IPage<IndexConfigDTO> queryIndexConfigPage(IndexConfigDiseaseNameVO indexConfigDiseaseNameVO) {
|
|
- IPage<IndexConfigDTO> datas = indexConfigService.queryIndexConfigPageAlls(indexConfigDiseaseNameVO);
|
|
|
|
|
|
+ IPage<IndexConfigDTO> datas = this.queryIndexConfigPageAlls(indexConfigDiseaseNameVO);
|
|
List<IndexConfigDTO> data = datas.getRecords();
|
|
List<IndexConfigDTO> data = datas.getRecords();
|
|
List<String> modifierid = new ArrayList<>();
|
|
List<String> modifierid = new ArrayList<>();
|
|
modifierid = data.stream().map(ac -> ac.getModifier()).collect(Collectors.toList());
|
|
modifierid = data.stream().map(ac -> ac.getModifier()).collect(Collectors.toList());
|
|
Map<String, String> userNames = new HashMap<>();
|
|
Map<String, String> userNames = new HashMap<>();
|
|
if (modifierid.size() > 0) {
|
|
if (modifierid.size() > 0) {
|
|
RespDTO<Map<String, String>> userNamesDTO = userServiceClient.getUserInfoByIds(modifierid);
|
|
RespDTO<Map<String, String>> userNamesDTO = userServiceClient.getUserInfoByIds(modifierid);
|
|
- if (userNamesDTO == null || !CommonErrorCode.OK.getCode().equals(userNamesDTO.code)) {
|
|
|
|
|
|
+ if (RespDTOUtil.respIsNG(userNamesDTO)) {
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取所有用户信息失败");
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取所有用户信息失败");
|
|
}
|
|
}
|
|
userNames = userNamesDTO.data;
|
|
userNames = userNamesDTO.data;
|
|
@@ -68,17 +68,14 @@ public class IndexConfigFacade extends IndexConfigServiceImpl {
|
|
List<IndexConfigDTO> indexConfigLists = new ArrayList<IndexConfigDTO>();
|
|
List<IndexConfigDTO> indexConfigLists = new ArrayList<IndexConfigDTO>();
|
|
for (IndexConfigDTO evalua : data) {
|
|
for (IndexConfigDTO evalua : data) {
|
|
IndexConfigDTO dateNew = new IndexConfigDTO();
|
|
IndexConfigDTO dateNew = new IndexConfigDTO();
|
|
- dateNew.setId(evalua.getId());
|
|
|
|
- dateNew.setCreator(evalua.getCreator());
|
|
|
|
- dateNew.setGmtModified(evalua.getGmtModified());
|
|
|
|
- dateNew.setDiseaseId(evalua.getDiseaseId());
|
|
|
|
- dateNew.setGmtCreate(evalua.getGmtCreate());
|
|
|
|
|
|
+ BeanUtil.copyProperties(evalua,dateNew);
|
|
dateNew.setModifier(userNames.get(evalua.getModifier()));
|
|
dateNew.setModifier(userNames.get(evalua.getModifier()));
|
|
- dateNew.setDiseaseName(evalua.getDiseaseName());
|
|
|
|
indexConfigLists.add(dateNew);
|
|
indexConfigLists.add(dateNew);
|
|
}
|
|
}
|
|
|
|
|
|
- return datas.setRecords(indexConfigLists);
|
|
|
|
|
|
+ datas.setRecords(indexConfigLists);
|
|
|
|
+
|
|
|
|
+ return datas;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
@@ -134,7 +131,8 @@ public class IndexConfigFacade extends IndexConfigServiceImpl {
|
|
*/
|
|
*/
|
|
public boolean saveIndexConfigList(IndexConfigListVO indexConfigListVO) {
|
|
public boolean saveIndexConfigList(IndexConfigListVO indexConfigListVO) {
|
|
boolean res = false;
|
|
boolean res = false;
|
|
- if (indexConfigListVO != null && ListUtil.isNotEmpty(indexConfigListVO.getIndexConfigData())) {
|
|
|
|
|
|
+ if (indexConfigListVO != null
|
|
|
|
+ && ListUtil.isNotEmpty(indexConfigListVO.getIndexConfigData())) {
|
|
List<IndexConfigVO> indexConfigData = indexConfigListVO.getIndexConfigData();
|
|
List<IndexConfigVO> indexConfigData = indexConfigListVO.getIndexConfigData();
|
|
List<String> indexUnique = new ArrayList<>();
|
|
List<String> indexUnique = new ArrayList<>();
|
|
for (IndexConfigVO e : indexConfigData) {
|
|
for (IndexConfigVO e : indexConfigData) {
|
|
@@ -143,9 +141,11 @@ public class IndexConfigFacade extends IndexConfigServiceImpl {
|
|
|
|
|
|
QueryWrapper<IndexConfig> IndexConfigQuery = new QueryWrapper<>();
|
|
QueryWrapper<IndexConfig> IndexConfigQuery = new QueryWrapper<>();
|
|
|
|
|
|
- IndexConfigQuery.in("index_unique", indexUnique);
|
|
|
|
|
|
+ IndexConfigQuery.eq("disease_id",indexConfigListVO.getDiseaseId())
|
|
|
|
+ .eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
|
+ .in("index_unique", indexUnique);
|
|
List<IndexConfig> dataUnique = list(IndexConfigQuery);
|
|
List<IndexConfig> dataUnique = list(IndexConfigQuery);
|
|
- if (dataUnique != null && dataUnique.size() > 0) {
|
|
|
|
|
|
+ if (ListUtil.isNotEmpty(dataUnique)) {
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
"该'" + dataUnique.get(0).getIndexUnique() + "'已存在");
|
|
"该'" + dataUnique.get(0).getIndexUnique() + "'已存在");
|
|
}
|
|
}
|