From db1c3c5b3670639fd1dfc5de0fe75ce6f02f732e Mon Sep 17 00:00:00 2001
From: wang1 <844966816@qq.com>
Date: 星期三, 31 五月 2023 14:40:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java |   54 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
index 03ef145..1ed0304 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -19,13 +19,15 @@
 import com.vci.ubcs.code.po.CodeClassifyPO;
 import com.vci.ubcs.code.service.ICodeClassifyService;
 import com.vci.ubcs.code.service.ICodeKeyAttrRepeatService;
+import com.vci.ubcs.code.service.ICodeOsattributeService;
 import com.vci.ubcs.code.service.ICodeRuleService;
 import com.vci.ubcs.code.vo.CodeOsattributeVO;
 import com.vci.ubcs.code.vo.CodeOsbtmtypeVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
-import com.vci.ubcs.core.log.exception.ServiceException;
+import com.vci.ubcs.omd.feign.IBtmTypeClient;
+import com.vci.ubcs.omd.vo.BtmTypeVO;
 import com.vci.ubcs.starter.bo.WriteExcelData;
 import com.vci.ubcs.starter.exception.VciBaseException;
 import com.vci.ubcs.starter.poi.bo.ReadExcelOption;
@@ -35,6 +37,7 @@
 import com.vci.ubcs.starter.revision.model.TreeQueryObject;
 import com.vci.ubcs.starter.revision.model.TreeWrapperOptions;
 import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
+import com.vci.ubcs.starter.util.BladeTreeQueryObject;
 import com.vci.ubcs.starter.util.LocalFileUtil;
 import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject;
 import com.vci.ubcs.starter.web.pagemodel.DataGrid;
@@ -46,10 +49,14 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springblade.core.cache.utils.CacheUtil;
+import org.springblade.core.launch.constant.AppConstant;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -74,10 +81,18 @@
 
 	@Resource
 	private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
+
 	@Resource
-	CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
+	private CodeOsbtmtypeattributeMapper codeOsbtmtypeattributeMapper;
+
 	@Resource
-	ICodeRuleService ICodeRuleService;
+	private IBtmTypeClient btmTypeClient;
+
+	/**
+	 * 灞炴�ф湇鍔�
+	 */
+//	@Autowired
+//	private OsAttributeServiceI attributeService;
 
 	/**
 	 * 鏃ュ織
@@ -258,7 +273,6 @@
 		return codeClassifyMapper.checkHasChild(oid.trim());
 	}
 
-
 	/**
 	 * 鍒犻櫎涓婚搴撳垎绫�
 	 * @param codeClassify 涓婚搴撳垎绫绘暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈�
@@ -363,7 +377,6 @@
 		return codeClassifyDO2VOs(codeClassifyDOList);
 	}
 
-
 	/**
 	 * 浣跨敤涓婚敭闆嗗悎鏌ヨ鏁版嵁瀵硅薄
 	 * @param oidCollections 涓婚敭鐨勯泦鍚�
@@ -382,7 +395,6 @@
 		}
 		return  codeClassifyList;
 	}
-
 
 	/**
 	 * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
@@ -508,8 +520,7 @@
 		return null;
 	}
 
-
-//	/**
+	//	/**
 //	 * 鏍规嵁鏍戝舰鏌ヨ瀵硅薄鏉ユ煡璇㈡暟鎹璞�
 //	 *
 //	 * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄
@@ -899,7 +910,7 @@
 		condition.put("pkbtmtype",topClassifyVO.getBtmtypeid());
 
 		List<CodeOsbtmtypeattributeEntity> unDefaultAttributes = codeOsbtmtypeattributeMapper.selectByMap(condition);
-//		List<OsBtmTypeAttributeVO> unDefaultAttributes = btmService. (topClassifyVO.getBtmtypeid());
+		// List<OsBtmTypeAttributeVO> unDefaultAttributes = btmService. (topClassifyVO.getBtmtypeid());
 		List<CodeOsattributeVO> attributeVOS = new ArrayList<>();
 		if(!CollectionUtils.isEmpty(unDefaultAttributes)){
 			unDefaultAttributes.stream().forEach(attr->{
@@ -909,6 +920,7 @@
 				attributeVO.setAttrlength(Short.valueOf(attr.getAttributelength()));
 				attributeVO.setBtmtypeid(attr.getReferbtmtypeid());
 				attributeVO.setBtmtypename(attr.getReferbtmtypename());
+				attributeVO.setAttributedatatypetext(attr.getReferbtmtypename());
 				boolean add = true;
 				if(StringUtils.isNotBlank(id) && !attributeVO.getId().contains(id.replace("*",""))){
 					add = false;
@@ -921,8 +933,8 @@
 				}
 			});
 		}
-//		if(!CollectionUtils.isEmpty(attributeService.getDefaultAttributeVOs())){
-//			attributeService.getDefaultAttributeVOs().stream().forEach(attr->{
+//		if(!CollectionUtils.isEmpty(codeOsattributeService.getDefaultAttributeVOs())){
+//			codeOsattributeService.getDefaultAttributeVOs().stream().forEach(attr->{
 //				boolean add = true;
 //				if(StringUtils.isNotBlank(id) && !attr.getId().contains(id.replace("*",""))){
 //					add = false;
@@ -1000,7 +1012,7 @@
 	 * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪鏃朵細鎶涘嚭寮傚父
 	 */
 	@Override
-	public  CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{
+	public CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{
 		return codeClassifyDO2VO(selectByOid(oid));
 	}
 
@@ -1021,7 +1033,7 @@
 	}
 
 	/**
-	 * 涓婚搴撶殑鏍�
+	 * 涓婚搴撶殑鏍�,宸茬粡鑱旇皟涓氬姟绫诲瀷鏌ヨ
 	 *
 	 * @param treeQueryObject 鏍戝舰鏌ヨ瀵硅薄
 	 * @return 涓婚搴撴樉绀烘爲
@@ -1032,10 +1044,20 @@
 			treeQueryObject = new TreeQueryObject();
 		}
 		if(treeQueryObject.getConditionMap() == null){
-			treeQueryObject.setConditionMap(new HashMap<>());
+			treeQueryObject.setConditionMap(new HashMap<String,String>());
 		}
 		treeQueryObject.getConditionMap().put(PARENT_FIELD_NAME, "=null");
-		return treeCodeClassify(treeQueryObject);
+		List<Tree> trees = treeCodeClassify(treeQueryObject);
+		treeQueryObject.getConditionMap().put("domain", AppConstant.APPLICATION_NAME_CODE);
+		BaseQueryObject baseQueryObject = new BaseQueryObject();
+		baseQueryObject.setConditionMap(treeQueryObject.getConditionMap());
+		List<BtmTypeVO> btmTypeVOS = btmTypeClient.getRef(baseQueryObject).getData();
+		if(Func.isEmpty(btmTypeVOS) || Func.isEmpty(trees)){
+			return null;
+		}
+		List<Tree> treeList = trees.stream().filter(tree -> btmTypeVOS.stream().
+			anyMatch(btmType -> Objects.equals(tree.getAttributes().get("id"), btmType.getId()))).collect(Collectors.toList());
+		return treeList;
 	}
 
 	/**
@@ -1106,7 +1128,6 @@
 		return fullInfo;
 	}
 
-
 	/**
 	 * 缁熻瀛愯妭鐐圭殑涓暟
 	 *
@@ -1121,4 +1142,5 @@
 		wrapper.eq("parentCodeClassifyOid",codeClassifyOid);
 		return codeClassifyMapper.selectCount(wrapper).intValue();
 	}
+
 }

--
Gitblit v1.9.3