From ac4e090952cfa701d7d681ada7d7900e3ce45755 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 17 五月 2024 11:05:03 +0800
Subject: [PATCH] 集成申请,历史数据导入,关键属性查重多线程导致判重失误问题

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
index 9177504..22f9c36 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -2424,7 +2424,7 @@
 		//閮借浆鎹㈠畬浜嗐�傞渶瑕佹壒閲忔鏌�
 		//濡傛灉鍑洪敊浜嗭紝鎴戜滑渚濈劧鎵ц鏈夋晥鐨勬暟鎹紝鏃犳晥鐨勬暟鎹啓鍥炲埌excel涓�
 
-		Map<String, String> errorKeyMap = new HashMap<>();
+		Map<String, String> errorKeyMap = new ConcurrentHashMap<>();
 		//1.鍒嗙被娉ㄥ叆
 		batchSwitchClassifyAttrOnOrder(attrVOS, cboList, classifyFullInfo, false);
 		//boolean
@@ -2447,6 +2447,7 @@
 		batchSwitchComponentAttrOnOrder(attrVOS, cboList);
 		//3.鍒ゆ柇鍏抽敭灞炴��
 		CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList, false, errorKeyMap);
+		log.info("================鏌ラ噸鍚庣殑errorKeyMap閿欒淇℃伅================="+JSON.toJSONString(errorKeyMap));
 		Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList();
 		Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList();
 
@@ -2688,7 +2689,6 @@
 
 			}
 		}
-
 	}
 
 	/***
@@ -4423,9 +4423,11 @@
 	 * @param classifyFullInfo 鍒嗙被鐨勫叏閮ㄤ俊鎭�
 	 * @param templateVO       妯℃澘鐨勫唴瀹癸紝蹇呴』鍖呭惈妯℃澘灞炴��
 	 * @param cboList          鎵归噺鐨勬暟鎹�
-	 */
+	 * @param isEdit          鏄惁鏄慨鏀�
+	 * @param errorMap          蹇呴』蹇呴』蹇呴』鏄嚎绋嬪畨鍏ㄧ殑闆嗗悎
+	 * */
 	private CodeImportResultVO batchCheckKeyAttrOnOrder(CodeClassifyFullInfoBO classifyFullInfo, CodeClassifyTemplateVO templateVO,
-														List<ClientBusinessObject> cboList, boolean isEdit, Map<String, String> errorMap) {
+														List<ClientBusinessObject> cboList, boolean isEdit, Map<String, String> errorMap/*蹇呴』瑕佹槸绾跨▼瀹夊叏鐨勯泦鍚�*/) {
 		//涓嶮dmEngineServiceImpl閲岀殑checkKeyAttrOnOrder鐩镐技
 		//鍏堣幏鍙栧叧閿睘鎬х殑瑙勫垯锛屼篃鍒╃敤缁ф壙鐨勬柟寮�
 		CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo);
@@ -4478,7 +4480,7 @@
 		// TODO:Thread limit exceeded replacing blocked 寮傚父鏄繖閮ㄥ垎浠g爜鎶涘嚭鐨�
 		//  ,鎵�浠ユ殏鏃跺皢parallelStream鏀规垚浜唖tream锛屾敼鎴愪簡stream涔嬪悗鍙戠幇宸ㄦ參
 		// customForkJoinPool鎺у埗骞跺彂搴�
-		List<ClientBusinessObject> finalCboList = cboList;
+		final List<ClientBusinessObject> finalCboList = cboList;
 		Map<String, List<CodeSynonym>> finalCodeSynonymMaps = codeSynonymMaps;
 		List<ClientBusinessObject> repeatDataMap = (List<ClientBusinessObject>) customForkJoinPool.submit(() -> {
 			finalCboList.parallelStream().filter(cbo -> {
@@ -4522,6 +4524,7 @@
 						});
 						// 娣诲姞閿欒鍊�
 						String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX);
+						log.info("=============鍏抽敭灞炴�ф煡璇㈤噸澶嶇殑============="+JSON.toJSONString(repeatData));
 						errorMap.put(rowIndex, "閲嶅鐨勮褰曠紪鍙蜂负:" + repeatData.stream().collect(Collectors.joining(",")));
 						if (!CollectionUtils.isEmpty(newCboList)) {
 							indexTODataMap.put(cbo.getAttributeValue(IMPORT_ROW_INDEX), newCboList);
@@ -5365,7 +5368,7 @@
 
 		List<String> codeList = cboList.stream().map(ClientBusinessObject::getId).collect(Collectors.toList());
 		List<Map<String, String>> dataList = new ArrayList<>();
-		Map<String, String> errorMap = new HashMap<>();
+		Map<String, String> errorMap = new ConcurrentHashMap<>();
 		batchSwitchCheckExist(errorMap, cboList, classifyFullInfo, templateVO, execGroupCodePortDataDTO, fieldIndexMap);
 		//鍒ゆ柇蹇呰緭椤�
 		batchCheckRequiredAttrOnOrder(templateVO, cboList, errorMap);

--
Gitblit v1.9.3