From dbe1b807e2a0e4aaa37277b69c50dd69dc42dda2 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期日, 25 六月 2023 10:34:36 +0800
Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   34 +++++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
index 0bba185..8df4c4c 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -2182,31 +2182,32 @@
 			deleteBatchDTO.getCodeClassifyOid(), "涓婚搴撳垎绫荤殑涓婚敭");
 		CodeClassifyFullInfoBO classifyFullInfo = classifyService.getClassifyFullInfo(deleteBatchDTO.getCodeClassifyOid());
 		//鎵句笟鍔$被鍨嬶紝鐒跺悗浣跨敤涓婚敭鍘昏幏鍙栨暟鎹簱閲岀殑鏁版嵁
-		Collection<String> oidCollection = null;
+		Collection<String> oidCollection = new ArrayList<>();
 		for (Collection<String> strings : VciBaseUtil.switchCollectionForOracleIn(deleteBatchDTO.getOidList())) {
 			oidCollection.addAll(strings);
 		}
 
-		List<CodeWupin> cboList = codeWupinMapper.selectBatchIds(oidCollection);
-		//		List<ClientBusinessObject> cboList = new ArrayList<>();
-//		oidCollection.stream().forEach(oids -> {
-//			Map<String, String> conditionMap = new HashMap<>();
+//		List<CodeWupin> cboList = codeWupinMapper.selectBatchIds(oidCollection);
+		List<BaseModel> cboList = new ArrayList<>();
+		oidCollection.stream().forEach(oids -> {
+			Map<String, String> conditionMap = new HashMap<>();
 //			conditionMap.put("oid", QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oids.toArray(new String[0])) + ")");
-//			List<ClientBusinessObject> cbos = boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), conditionMap);
-//			cboList.addAll(cbos);
-//		});
+			List<BaseModel> cbos = selectByTypeAndOid(classifyFullInfo.getTopClassifyVO().getBtmtypeid(),oids);
+//				boService.queryCBO(classifyFullInfo.getTopClassifyVO().getBtmtypeid(), conditionMap);
+			cboList.addAll(cbos);
+		});
 		if (CollectionUtils.isEmpty(cboList)) {
 			throw new VciBaseException("鏁版嵁鍏ㄩ儴鍦ㄧ郴缁熶腑涓嶅瓨鍦�");
 		}
-		List<CodeWupin> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList());
+		List<BaseModel> editCBOs = cboList.stream().filter(s -> !CodeDefaultLC.EDITING.getValue().equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList());
 		if (!CollectionUtils.isEmpty(editCBOs)) {
-			CodeWupin cbo = editCBOs.get(0);
+			BaseModel cbo = editCBOs.get(0);
 			throw new VciBaseException("缂栫爜涓簕0}绛夊叡{1}鏉℃暟鎹殑鐘舵�佷笉鏄痆{2}]锛屼笉鍏佽鍒犻櫎", new String[]{cbo.getId(), String.valueOf(editCBOs.size()), CodeDefaultLC.EDITING.getText()});
 		}
 
 		//鍙兘鍒犻櫎鑷繁鍒涘缓鐨勬暟鎹�
-		String userId = AuthUtil.getUser().getUserName();
-		for (CodeWupin clientBusinessObject : cboList) {
+		String userId = String.valueOf(AuthUtil.getUser().getUserId());
+		for (BaseModel clientBusinessObject : cboList) {
 			String creator = clientBusinessObject.getCreator();
 			if (!userId.equalsIgnoreCase(creator)) {
 				throw new VciBaseException("缂栫爜涓�" + clientBusinessObject.getId() + "鐨勬暟鎹笉鏄綋鍓嶇敤鎴峰垱寤猴紝涓嶈兘鍒犻櫎锛�");
@@ -2218,7 +2219,14 @@
 //		WebUtil.setPersistence(false);
 //		batchCBO.copyFromOther(
 		productCodeService.recycleCode(classifyFullInfo.getCurrentClassifyVO().getBtmtypeid(), deleteBatchDTO.getOidList());
-		baseMapper.deleteBatchIds(cboList);
+//		baseMapper.deleteBatchIds(cboList);
+		//浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+		R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getCurrentClassifyVO().getBtmtypeid()));
+		if (listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
+		commonsMapper.deleteByTaleAndOid(listR.getData().get(0).getTableName(),
+			"'"+(StringUtils.join(cboList.stream().map(BaseModel::getOid).collect(Collectors.toSet()),"','"))+"'");
 		//		);
 //		WebUtil.setPersistence(true);
 //		boService.persistenceBatch(batchCBO);

--
Gitblit v1.9.3