From dd6942743fa3936a1bbcbe6f4102c028d8021d5c Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 05 六月 2023 16:56:35 +0800
Subject: [PATCH] 完善高级查询组件

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeReferBtmTypeServiceImpl.java |   37 +++++++++++++++++--------------------
 1 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeReferBtmTypeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeReferBtmTypeServiceImpl.java
index 4b0cc5e..62b83ca 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeReferBtmTypeServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeReferBtmTypeServiceImpl.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.vci.ubcs.code.service.ICodeReferBtmTypeService;
 import com.vci.ubcs.omd.feign.IAttributeClient;
+import com.vci.ubcs.omd.feign.IBtmAttributeClient;
 import com.vci.ubcs.omd.feign.IBtmTypeClient;
 import com.vci.ubcs.omd.vo.AttributeVO;
 import com.vci.ubcs.omd.vo.BtmTypeAttributeVO;
@@ -39,12 +40,6 @@
 	private IBtmTypeClient btmTypeClient;
 
 	/**
-	 * 涓氬姟绫诲瀷灞炴�ф湇鍔�
-	 */
-	@Resource
-	private IAttributeClient attributeClient;
-
-	/**
 	 * 鑾峰彇涓氬姟绫诲瀷鍒楄〃
 	 * @param baseQueryObject 鏌ヨ鏉′欢
 	 * @return 鍒楄〃鐨勫唴瀹�
@@ -54,13 +49,11 @@
 		Map<String, String> conditionMap = baseQueryObject.getConditionMap();
 		conditionMap.put("domain", AppConstant.APPLICATION_NAME_CODE);
 		baseQueryObject.setConditionMap(conditionMap);
-		Page<BtmTypeVO> refPage = null;
-		try {
-			refPage = btmTypeClient.getRefPage(baseQueryObject).getData();
-		}catch (Exception e){
+		R<Page<BtmTypeVO>> btmTypeClientRefPage = btmTypeClient.getRefPage(baseQueryObject);
+		if(btmTypeClientRefPage.getCode() != 200){
 			throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒");
 		}
-		return refPage;
+		return btmTypeClientRefPage.getData();
 	}
 
 	/**
@@ -69,25 +62,28 @@
 	 * @return 灞炴�х殑淇℃伅
 	 */
 	@Override
-	public Page<AttributeVO> gridAttributesByBtmId(BaseQueryObject baseQueryObject) {
+	public Page<BtmTypeAttributeVO> gridAttributesByBtmId(BaseQueryObject baseQueryObject) throws ServiceException {
 		String btmTypeId = baseQueryObject.getConditionMap().containsKey("btmTypeId")?baseQueryObject.getConditionMap().get("btmTypeId"):"";
 		if(StringUtils.isBlank(btmTypeId)){
-			return new Page<AttributeVO>();
+			return new Page<>();
 		}
 		String hasDefaultAttr = baseQueryObject.getConditionMap().getOrDefault("hasDefaultAttr","false");
 		String attrId = baseQueryObject.getConditionMap().containsKey("name")?baseQueryObject.getConditionMap().get("name").replace("*",""):"";
 		String attrName = baseQueryObject.getConditionMap().containsKey("label") ? baseQueryObject.getConditionMap().get("label").replace("*","") : "";
-		// TODO 鏍规嵁涓氬姟绫诲瀷id鑾峰彇鍏宠仈鐨勫睘鎬�
-		List<BtmTypeAttributeVO> boAttrs = null; //attributeClient.get();
+		List<BtmTypeAttributeVO> boAttrs = null;
+		try {
+			boAttrs = btmTypeClient.getAllAttributeByBtmId(btmTypeId).getData().getAttributes();
+		}catch (Exception e){
+			throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒");
+		}
 		if(boAttrs == null){
 			boAttrs = new ArrayList<>();
 		}
 		if(BooleanEnum.TRUE.getValue().equalsIgnoreCase(hasDefaultAttr)){
 			// TODO 鑾峰彇榛樿鐨勫睘鎬�
 			List<BtmTypeAttributeVO> finalBoAttrs = boAttrs;
-
-			List<BtmTypeAttributeVO> btmTypeAttributeVOS = new ArrayList<>(); //attributeClient.getDefaultAttributeVOs();
-			btmTypeAttributeVOS.stream().forEach(attr->{
+			BtmTypeVO btmTypeVO = btmTypeClient.getDefaultAttrByBtmId(btmTypeId).getData();
+			btmTypeVO.getAttributes().stream().forEach(attr->{
 				BtmTypeAttributeVO attributeVO = new BtmTypeAttributeVO();
 				BeanUtil.convert(attr,attributeVO);
 				attributeVO.setAttributeLength(attr.getAttributeLength());
@@ -108,8 +104,9 @@
 			}
 			return usedFlag;
 		}).collect(Collectors.toList());
-
-		return new Page<>();
+		Page<BtmTypeAttributeVO> btmTypeAttributeVOPage = new Page<>();
+		btmTypeAttributeVOPage.setRecords(attrList);
+		return btmTypeAttributeVOPage;
 	}
 
 

--
Gitblit v1.9.3