From ea44fca5c2b4e0101a43bea607ce1de1bdc6e173 Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期三, 12 七月 2023 17:27:24 +0800
Subject: [PATCH] 业务类型相关的修正,主要兼容达梦。

---
 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java |   63 ++++++++++++++++++++++++++++---
 1 files changed, 57 insertions(+), 6 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 af7f220..2a64160 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
@@ -204,7 +204,7 @@
 	 */
 	@Override
 	public List<BtmType> listBtmTypeDOByIdCollection(Collection<String> idCollection) throws ServiceException {
-		return CollectionUtils.isEmpty(idCollection) ? null : baseMapper.selectList(Wrappers.<BtmType>query().lambda().in(BtmType::getId, idCollection));
+		return CollectionUtils.isEmpty(idCollection) ? null : baseMapper.selectByIdCollection(idCollection);
 	}
 
 	/**
@@ -495,7 +495,7 @@
 		}
 		checkBtmTypeBeforeSave(btmTypeDTO);
 		BtmType btmTypeDO = Optional.ofNullable(BeanUtil.copy(btmTypeDTO, BtmType.class)).orElseGet(BtmType::new);
-		btmTypeDO.setBizDomain(btmTypeDTO.getDomain());
+		btmTypeDO.setBizDomain(btmTypeDTO.getBizDomain());
 		List<BtmTypeLinkAttributesDTO> attributes = btmTypeDTO.getAttributes();
 		List<BtmTypeAttributeVO> afterAttributes;
 		if (StringUtils.isBlank(btmTypeDO.getOid())){
@@ -521,7 +521,7 @@
 		try {
 			if (autoCreateTable) {
 //				checkTableSame(btmTypeVO);
-				R result = DomainRepeater.submitBtmType(btmTypeDTO.getDomain(), btmTypeVO);
+				R result = DomainRepeater.submitBtmType(btmTypeDTO.getBizDomain(), btmTypeVO);
 				if (result.isSuccess()){
 					List<ModifyAttributeInfo> infoList = new ArrayList<>();
 					Object data = result.getData();
@@ -595,11 +595,14 @@
 		if (btmTypeDTO.getId().length() > 24) {
 			throw new VciBaseException("涓氬姟绫诲瀷鑻辨枃鍚嶇О涓嶈兘瓒呰繃18锛岀洰鍓嶉暱搴︿负{0}", new Object[]{btmTypeDTO.getId().length()});
 		}
-		List<BtmType> btmTypeDOList = listBtmTypeDOByIdCollection(VciBaseUtil.str2List(btmTypeDTO.getId()));
+		List<BtmType> btmTypeDOList = listBtmTypeDOByIdCollection(VciBaseUtil.str2List(btmTypeDTO.getId().toLowerCase(Locale.ROOT)));
 		if (!CollectionUtils.isEmpty(btmTypeDOList) && btmTypeDOList.size() > 0) {
+			boolean exist = btmTypeDOList.stream().filter(btm -> StringUtils.isNotBlank(btm.getOid())).anyMatch(btm -> !StringUtils.equals(btmTypeDTO.getOid(), btm.getOid()));
 			BtmType existBtmType = btmTypeDOList.get(0);
-			throw new VciBaseException("涓氬姟绫诲瀷鑻辨枃鍚嶇О宸茬粡瀛樺湪锛堜笉鍖哄垎澶у皬鍐欙級锛岃繖涓嫳鏂囧悕绉板搴旂殑涓枃鍚嶇О涓簕0},鍒涘缓浜簕1},鍒涘缓鏃堕棿{2}"
-				, new Object[]{existBtmType.getName(), existBtmType.getCreator(), VciDateUtil.date2Str(existBtmType.getCreateTime(), VciDateUtil.DateFormat)});
+			if (exist) {
+				throw new VciBaseException("涓氬姟绫诲瀷鑻辨枃鍚嶇О宸茬粡瀛樺湪锛堜笉鍖哄垎澶у皬鍐欙級锛岃繖涓嫳鏂囧悕绉板搴旂殑涓枃鍚嶇О涓簕0},鍒涘缓浜簕1},鍒涘缓鏃堕棿{2}"
+					, new Object[]{existBtmType.getName(), existBtmType.getCreator(), VciDateUtil.date2Str(existBtmType.getCreateTime(), VciDateUtil.DateFormat)});
+			}
 		}
 		if (btmTypeDTO.isRevisionFlag()){
 			// 闇�瑕佹帶鍒剁増鏈�
@@ -887,6 +890,30 @@
 	}
 
 	/**
+	 * 鑾峰彇寮曠敤鏌愪簺鐢熷懡鍛ㄦ湡鐨勪笟鍔$被鍨�
+	 *
+	 * @param lifeIds 鐢熷懡鍛ㄦ湡鐨勭紪鍙烽泦鍚�
+	 * @return 涓氬姟绫诲瀷鏄剧ず瀵硅薄
+	 */
+	@Override
+	public List<BtmTypeVO> selectByLifeIds(Collection<String> lifeIds) {
+		if(CollectionUtils.isEmpty(lifeIds)){
+			return new ArrayList<>();
+		}
+		List<BtmType> btmTypeList = new ArrayList<>();
+		VciBaseUtil.switchCollectionForOracleIn(lifeIds).stream().forEach(ids->{
+			LambdaQueryWrapper<BtmType> query = new LambdaQueryWrapper<BtmType>();
+			ids.stream().forEach(id->{
+				query.eq(BtmType::getLifeCycleId,id);
+				query.or();
+			});
+			query.eq(BtmType::getLifeCycleId,"-1");
+			btmTypeList.addAll(baseMapper.selectList(query));
+		});
+		return BtmTypeWrapper.build().listEntityVO(btmTypeList);
+	}
+
+	/**
 	 * 缁熻寮曠敤鏌愪釜鐢熷懡鍛ㄦ湡鐨勪笟鍔$被鍨�
 	 *
 	 * @param lifeId 鐢熷懡鍛ㄦ湡鐨勭紪鍙�
@@ -901,4 +928,28 @@
 		query.eq(BtmType::getLifeCycleId,lifeId);
 		return baseMapper.selectCount(query).intValue();
 	}
+
+	/**
+	 * 缁熻寮曠敤鏌愪簺鐢熷懡鍛ㄦ湡鐨勪笟鍔$被鍨�
+	 *
+	 * @param lifeIds 鐢熷懡鍛ㄦ湡鐨勭紪鍙烽泦鍚�
+	 * @return 涓暟
+	 */
+	@Override
+	public Integer countByLifeIds(Collection<String> lifeIds) {
+		if(CollectionUtils.isEmpty(lifeIds)){
+			return 0;
+		}
+		final Integer[] total = {0};
+		VciBaseUtil.switchCollectionForOracleIn(lifeIds).stream().forEach(ids->{
+			LambdaQueryWrapper<BtmType> query = new LambdaQueryWrapper<BtmType>();
+			ids.stream().forEach(id->{
+				query.eq(BtmType::getLifeCycleId,id);
+				query.or();
+			});
+			query.eq(BtmType::getLifeCycleId,"-1");
+			total[0] += baseMapper.selectCount(query).intValue();
+		});
+		return total[0];
+	}
 }

--
Gitblit v1.9.3