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/CodeClassifyServiceImpl.java |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 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 1740d98..41877d6 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
@@ -873,7 +873,7 @@
 	 * @return 灞炴�х殑淇℃伅锛屽寘鍚粯璁ょ殑灞炴��
 	 */
 	@Override
-	public DataGrid<BtmTypeAttributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject) {
+	public DataGrid<BtmTypeAttributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject) throws ServiceException{
 		if(baseQueryObject == null){
 			baseQueryObject = new BaseQueryObject();
 		}
@@ -897,8 +897,11 @@
 
 		Map<String,Object> condition = new HashMap<>(1);
 		condition.put("pkbtmtype",topClassifyVO.getBtmtypeid());
-		BtmTypeVO data = btmTypeClient.getDetail(btmTypeOid).getData();
-		List<BtmTypeAttributeVO> unDefaultAttributes = data.getAttributes();
+		R<BtmTypeVO> btmTypeDetail = btmTypeClient.getDetail(btmTypeOid);
+		if(btmTypeDetail.getCode() != 200){
+			throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤鍑洪敊");
+		}
+		List<BtmTypeAttributeVO> unDefaultAttributes = btmTypeDetail.getData().getAttributes();
 		// List<CodeOsbtmtypeattributeEntity> unDefaultAttributes = codeOsbtmtypeattributeMapper.selectByMap(condition);
 		// List<OsBtmTypeAttributeVO> unDefaultAttributes = btmService. (topClassifyVO.getBtmtypeid());
 		List<BtmTypeAttributeVO> attributeVOS = new ArrayList<>();
@@ -908,8 +911,8 @@
 				BeanUtils.copyProperties(attr,attributeVO);
 				attributeVO.setAttrDataType(attr.getAttrDataType());
 				attributeVO.setAttributeLength(attr.getAttributeLength());
-				attributeVO.setBtmTypeId(data.getId());
-				attributeVO.setBtmname(data.getName());
+				attributeVO.setBtmTypeId(btmTypeDetail.getData().getId());
+				attributeVO.setBtmname(btmTypeDetail.getData().getName());
 				attributeVO.setAttrDataTypeText(EnumCache.getValue(EnumEnum.VCO_FIELD_TYPE,attr.getAttrDataType()));
 				boolean add = true;
 				if(StringUtils.isNotBlank(id) && !attributeVO.getId().contains(id.replace("*",""))){
@@ -923,6 +926,25 @@
 				}
 			});
 		}
+		R<BtmTypeVO> btmTypeVOR = btmTypeClient.getDefaultAttrByBtmId(topClassifyVO.getBtmtypeid());
+		if(btmTypeVOR.getCode() != 200){
+			throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤鍑洪敊");
+		}
+		List<BtmTypeAttributeVO> defaultAttrVOS = btmTypeVOR.getData().getAttributes();
+		if(!CollectionUtils.isEmpty(defaultAttrVOS)){
+			defaultAttrVOS.stream().forEach(attr->{
+				boolean add = true;
+				if(StringUtils.isNotBlank(id) && !attr.getId().contains(id.replace("*",""))){
+					add = false;
+				}
+				if(StringUtils.isNotBlank(name) && !attr.getId().contains(name.replace("*",""))){
+					add = false;
+				}
+				if(add){
+					attributeVOS.add(attr);
+				}
+			});
+		}
 		DataGrid<BtmTypeAttributeVO> dataGrid = new DataGrid<>();
 		dataGrid.setData(attributeVOS);
 		dataGrid.setTotal(attributeVOS.size());

--
Gitblit v1.9.3