From 54e14bff397221b5b0d64720f77217f4d34ebf98 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 14 七月 2023 09:50:53 +0800
Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs

---
 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java
index 2a64160..23d8bde 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java
@@ -10,7 +10,7 @@
 import com.vci.ubcs.omd.constant.BtmTypeConstant;
 import com.vci.ubcs.omd.constant.BtmTypeFieldConstant;
 import com.vci.ubcs.omd.dto.BtmAndLinkTypeDdlDTO;
-import com.vci.ubcs.omd.entity.Attribute;
+import com.vci.ubcs.omd.entity.*;
 import com.vci.ubcs.omd.repeater.DomainRepeater;
 import com.vci.ubcs.omd.service.*;
 import com.vci.ubcs.omd.vo.*;
@@ -19,9 +19,6 @@
 import com.vci.ubcs.starter.web.constant.OmdRegExpConstant;
 import com.vci.ubcs.omd.dto.BtmTypeDTO;
 import com.vci.ubcs.omd.dto.BtmTypeLinkAttributesDTO;
-import com.vci.ubcs.omd.entity.BtmType;
-import com.vci.ubcs.omd.entity.BtmTypeAttribute;
-import com.vci.ubcs.omd.entity.ModifyAttributeInfo;
 import com.vci.ubcs.omd.mapper.BtmTypeMapper;
 import com.vci.ubcs.starter.exception.VciBaseException;
 import com.vci.ubcs.starter.web.enumpck.BooleanEnum;
@@ -85,6 +82,12 @@
 	 */
 	@Autowired
 	private IAttributeService attributeService;
+
+	/**
+	 * 鐢熷懡鍛ㄦ湡鐨勬湇鍔�
+	 */
+	@Autowired
+	private ILifeCycleService lifeCycleService;
 
 	/**
 	 * 琛ㄥ悕鍓嶇紑
@@ -617,13 +620,14 @@
 		if (btmTypeDTO.isLifeCycleFlag()){
 			// 闇�瑕佹帶鍒剁敓鍛藉懆鏈�
 			//妫�鏌ヤ娇鐢ㄧ殑鐢熷懡鍛ㄦ湡鏄惁瀛樺湪
-//				if (StringUtils.isNotBlank(btmTypeDTO.getLifeCycleId())
-//					&& !FrameWorkLcStatusConstant.EMTYPE_LIFE_CYCLE.equalsIgnoreCase(btmTypeDTO.getLifeCycleId())) {
-//					if (lifeCycleServiceI.checkLifeCycleExist(btmTypeDTO.getLifeCycleId())) {
-//						throw new VciBaseException("鐢熷懡鍛ㄦ湡{0}[{1}]鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇峰厛鏌ヨ瘉",
-//							new Object[]{btmTypeDTO.getLifeCycleId(), btmTypeDTO.getLifeCycleName()});
-//					}
-//				}
+				if (StringUtils.isNotBlank(btmTypeDTO.getLifeCycleId())
+//					&& !FrameWorkLcStatusConstant.EMTYPE_LIFE_CYCLE.equalsIgnoreCase(btmTypeDTO.getLifeCycleId())
+				) {
+					if (lifeCycleService.getOne(Wrappers.<LifeCycleRule>query().lambda().eq(LifeCycleRule::getId,btmTypeDTO.getLifeCycleId())) == null) {
+						throw new VciBaseException("鐢熷懡鍛ㄦ湡{0}[{1}]鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇峰厛鏌ヨ瘉",
+							new Object[]{btmTypeDTO.getLifeCycleId(), btmTypeDTO.getLifeCycleName()});
+					}
+				}
 //				if (StringUtils.isNotBlank(btmTypeDTO.getSubLifeCycleId())) {
 //					if (lifeCycleServiceI.checkLifeCycleExist(btmTypeDTO.getSubLifeCycleId())) {
 //						throw new VciBaseException("澶囩敤鐢熷懡鍛ㄦ湡{0}[{1}]涓叾涓湁鏌愪簺鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇峰厛鏌ヨ瘉",
@@ -655,7 +659,10 @@
 		try {
 			Map<String, String> domain = Optional.ofNullable(DomainRepeater.getDomain()).orElseGet(ArrayList::new).stream().collect(Collectors.toMap(DomainVO::getValue, DomainVO::getLabel));
 			List<BtmTypeVO> vos = BtmTypeWrapper.build().listEntityVO(baseMapper.selectAll());
-			Map<String, List<BtmTypeVO>> domainMap = vos.stream().sorted(Comparator.comparing(BtmTypeVO::getId)).collect(Collectors.groupingBy(BtmTypeVO::getBizDomain));
+			if (CollectionUtils.isEmpty(vos)){
+				return new ArrayList<>();
+			}
+			Map<String, List<BtmTypeVO>> domainMap = Optional.ofNullable(vos).orElseGet(ArrayList::new).stream().sorted(Comparator.comparing(BtmTypeVO::getId)).collect(Collectors.groupingBy(BtmTypeVO::getBizDomain));
 			List<BtmTreeVO> treeList = new ArrayList<>();
 			domainMap.forEach((k,v)-> {
 				if (domain.containsKey(k)){
@@ -664,11 +671,13 @@
 					parent.setName(label);
 					parent.setLabel(label);
 					parent.setId(k);
+					parent.setLevel(1);
 					parent.setChildList(v.stream().map(s -> {
 						BtmTreeVO child = new BtmTreeVO();
 						child.setOid(s.getOid());
 						child.setName(s.getName());
 						child.setId(s.getId());
+						child.setLevel(2);
 						child.setLabel(s.getId() +  (s.getName() == null ? "" : "(" + s.getName() + ")"));
 						return child;
 					}).collect(Collectors.toList()));

--
Gitblit v1.9.3