From c5badac7106d4ec7f419283b39b435a92f275fbd Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 30 十月 2023 09:10:18 +0800
Subject: [PATCH] 前端增加码段类型枚举类,实现修改码段类型时提供是否清空码值对话框功能

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java |   95 ++++++++++++++++++++++++++---------------------
 1 files changed, 52 insertions(+), 43 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 b771af5..b274e0b 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
@@ -65,6 +65,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -787,7 +788,7 @@
 		String uuid=VciBaseUtil.getPk();
 		boolean isCreateUUid=false;
 		boolean isExport=false;
-		long start = System.currentTimeMillis();
+		//long start = System.currentTimeMillis();
 		for(int i=0;i<sheetDataSetList.size()-1;i++) {
 			if (CollectionUtils.isEmpty(sheetDataSetList) || CollectionUtils.isEmpty(sheetDataSetList.get(i).getRowData())
 				|| sheetDataSetList.get(i).getRowData().size() < 1) {
@@ -815,7 +816,7 @@
 			//鎵剧涓�琛岋紝涓轰簡鎵炬爣棰�
 			CodeClassifyTemplateVO templateVO = new CodeClassifyTemplateVO();
 			/**  if (!templateService.checkChildHasSameTemplate(classifyFullInfo.getCurrentClassifyVO().getOid())) {
-			 throw new VciBaseException("褰撳墠鐨勫垎绫讳互鍙婁笅绾у垎绫荤殑妯℃澘涓嶇浉鍚�");
+			 	throw new VciBaseException("褰撳墠鐨勫垎绫讳互鍙婁笅绾у垎绫荤殑妯℃澘涓嶇浉鍚�");
 			 }***/
 			//閮借浆鎹㈠畬浜嗐�傞渶瑕佹壒閲忔鏌�
 			//鎵炬墍鏈夌殑鍒嗙被璺緞,闇�瑕佹牎楠岃矾寰勬槸鍚︽纭紝鏄惁閮藉湪褰撳墠鐨勫垎绫荤殑涓嬬骇
@@ -932,7 +933,8 @@
 			if (CollectionUtils.isEmpty(ruleOidMap.values())) {
 				throw new VciBaseException("瀵煎叆鐨勬暟鎹墍閫夋嫨鐨勫垎绫婚兘娌℃湁璁剧疆缂栫爜瑙勫垯");
 			}
-			Map<String, CodeRuleVO> ruleVOMap = ruleService.listCodeRuleByIds(ruleOidMap.values(), true).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
+			// TODO: 鏀圭敤oid鏌ヨ瑙勫垯鐨勶紝鍒敤id
+			Map<String, CodeRuleVO> ruleVOMap = ruleService.listCodeRuleByOids(ruleOidMap.values()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
 			//鏍¢獙缂栫爜瑙勫垯鍜岀爜娈垫槸鍚︽纭�
 			Map<String, List<String>> ruleRowIndexMap = new ConcurrentHashMap<>();
 			checkSecLengthInHistory(cboList, classifyVOMap, ruleVOMap, ruleOidMap, errorMap, ruleRowIndexMap);
@@ -1057,7 +1059,7 @@
 				engineService.batchSaveSelectChar(templateVO, dataCBOIdList);
 			}
 		}
-		long end = System.currentTimeMillis();
+		//long end = System.currentTimeMillis();
 		//log.info("=============for鎵ц鏃堕棿================="+String.valueOf((end-start)/1000));
 		String excelFileName="";
 		if(isExport&&!CollectionUtils.isEmpty(shetNameMap)) {
@@ -1749,7 +1751,8 @@
 				Map<String/**鍒嗙被涓婚敭**/, String/**瑙勫垯涓婚敭**/> ruleOidMap = new ConcurrentHashMap<String, String>();
 				List<String> unExistRuleClassifyOidList = new CopyOnWriteArrayList<>();
 				checkRuleOidInHistory(classifyVOMap, ruleOidMap, unExistRuleClassifyOidList);
-				ruleVOMap = ruleService.listCodeRuleByIds(ruleOidMap.values(), true).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
+				// TODO	鏀圭敤oid鏌ヨ鐨勶紝杩欏効涓嶈鐢╥d
+				ruleVOMap = ruleService.listCodeRuleByOids(ruleOidMap.values()).stream().collect(Collectors.toMap(s -> s.getOid(), t -> t));
 
 				checkSecLengthInHistory(cboList, classifyVOMap, ruleVOMap, ruleOidMap, errorMap, ruleRowIndexMap);
 			}
@@ -1955,16 +1958,29 @@
 
 		//閮借浆鎹㈠畬浜嗐�傞渶瑕佹壒閲忔鏌�
 		//濡傛灉鍑洪敊浜嗭紝鎴戜滑渚濈劧鎵ц鏈夋晥鐨勬暟鎹紝鏃犳晥鐨勬暟鎹啓鍥炲埌excel涓�
+
+
+		Map<String,String> errorKeyMap=new HashMap<>();
+		//1.鍒嗙被娉ㄥ叆
+		batchSwitchClassifyAttrOnOrder(attrVOS,cboList,classifyFullInfo,false);
+		//boolean
+		reSwitchBooleanAttrOnOrder(attrVOS,cboList);
+		// cboList.stream().forEach(cbo->{
+		//2.鏍¢獙瑙勫垯
+		batchCheckVerifyOnOrder(attrVOS, cboList,errorMap);
+		//3.鏍¢獙鏋氫妇鏄惁姝g‘
+		batchSwitchEnumAttrOnOrder(attrVOS,cboList,errorMap);
+		//4.鏃堕棿鏍煎紡鐨勯獙璇�
+		//4.鏃堕棿鐨勶紝蹇呴』缁熶竴涓簓yyy-MM-dd HH:mm:ss
+		batchSwitchDateAttrOnOrder(attrVOS,cboList,errorMap);
+		//5.澶勭悊鍙傜収鐨勬儏鍐�
+		batchSwitchReferAttrOnOrder(attrVOS,cboList,errorMap);
+		//6璁剧疆榛樿鍊�
+		batchSwitchAttrDefault(attrVOS, cboList);
 		//2.鍒ゆ柇蹇呰緭椤广�傘�傞渶瑕佸叏閮ㄧ殑灞炴�э紝濡傛灉鏄繀杈擄紝浣嗘槸琛ㄥ崟閲岄潰涓嶆樉绀虹殑锛屽彧鑳芥槸鍒嗙被娉ㄥ叆鎴栬�呯粍鍚堣鍒�
 		batchCheckRequiredAttrOnOrder(templateVO,cboList,errorMap);
-
-
-		/**
-		 * 鍏抽敭鐔熸倝閿欒鎻愮ず
-		 */
-		Map<String,String> errorKeyMap=new HashMap<>();
-
-
+		//鏈�鍚庡紕缁勫悎瑙勫垯
+		batchSwitchComponentAttrOnOrder(attrVOS,cboList);
 		//3.鍒ゆ柇鍏抽敭灞炴��
 		CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList);
 		Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList();
@@ -2001,20 +2017,6 @@
 				errorKeyMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";鍏抽敭灞炴�т笌绯荤粺涓殑閲嶅" );
 			});
 		}
-		//鍒嗙被娉ㄥ叆
-		batchSwitchClassifyAttrOnOrder(attrVOS,cboList,classifyFullInfo,false);
-		//boolean
-		reSwitchBooleanAttrOnOrder(attrVOS,cboList);
-		// cboList.stream().forEach(cbo->{
-		//4.鏍¢獙瑙勫垯
-		batchCheckVerifyOnOrder(attrVOS, cboList,errorMap);
-		//5.鏍¢獙鏋氫妇鏄惁姝g‘
-		batchSwitchEnumAttrOnOrder(attrVOS,cboList,errorMap);
-		//6.鏃堕棿鏍煎紡鐨勯獙璇�
-		//6.鏃堕棿鐨勶紝蹇呴』缁熶竴涓簓yyy-MM-dd HH:mm:ss
-		batchSwitchDateAttrOnOrder(attrVOS,cboList,errorMap);
-		//7.澶勭悊鍙傜収鐨勬儏鍐�
-		batchSwitchReferAttrOnOrder(attrVOS,cboList,errorMap);
 		//鏍¢獙灞炴�ф槸鍚︽纭敊璇俊鎭�
 		if(errorMap.size()>0){
 			String[] newMsg = {""};
@@ -2115,10 +2117,7 @@
 		}
 
 		//  });
-		//璁剧疆榛樿鍊�
-		batchSwitchAttrDefault(attrVOS, cboList);
-		//鏈�鍚庡紕缁勫悎瑙勫垯
-		batchSwitchComponentAttrOnOrder(attrVOS,cboList);
+
 		//瑕佹妸浠ヤ笂鐨勯敊璇殑閮芥姏鍑哄悗锛屽啀缁х画澶勭悊鏃堕棿鍜岀粍鍚堣鍒�
 		List<ClientBusinessObject> needSaveCboList = cboList.stream().filter(cbo -> {
 			String rowIndex =cbo.getAttributeValue(IMPORT_ROW_INDEX);
@@ -2368,6 +2367,7 @@
 			String dataStatus=cbo.getLcStatus();
 			RowDatas rowData=codeDataMap.get(code);
 			String status=rowData.getStatus();
+			String lastModifier= rowData.getEditor();
 			String operation=rowData.getOperation();
 			if (cbo.getTs().compareTo(orderDTO.getTs())==0?false:true) {
 				// throw new VciBaseException("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯");
@@ -2377,20 +2377,20 @@
                 throw new VciBaseException("鏁版嵁涓嶆槸{0}鐨勭姸鎬侊紝涓嶅厑璁镐慨鏀�", new String[]{CodeDefaultLC.EDITING.getText()});
             }*/
 			if(operation.equals("update")) {
-				//1. 鍒ゆ柇蹇呰緭椤�
-				checkRequiredAttrOnOrder(templateVO, orderDTO, errorMap);
-				//2.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
+				//1.鍏堟敞鍏ワ紝鍐嶇粍鍚堬紝鏈�鍚庢牎楠�
 				switchClassifyLevelOnOrder(templateVO, classifyFullInfo, orderDTO, errorMap);
-				//3.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
+				//2.澶勭悊缁勫悎瑙勫垯銆傜粍鍚堣鍒欎笉鑳戒娇鐢ㄧ紪鐮佺殑灞炴�э紝鍥犱负缂栫爜鐨勭敓鎴愬彲鑳芥槸闇�瑕佸睘鎬х殑
 				switchComponentAttrOnOrder(templateVO, orderDTO);
-				//4.鏍¢獙瑙勫垯
+				//3.鏍¢獙瑙勫垯
 				checkVerifyOnOrder(templateVO, orderDTO, errorMap);
-				//5.鍒ゆ柇鍏抽敭灞炴��
-				checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO, errorMap);
-				//6.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭�
+				//4.鏍¢獙鏋氫妇鐨勫唴瀹规槸鍚︽纭�
 				checkEnumOnOrder(templateVO, orderDTO, errorMap);
-				//7.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
+				//5.澶勭悊鏃堕棿鏍煎紡锛屽湪鏁版嵁搴撻噷闈笉璁烘槸瀛楃涓茶繕鏄棩鏈熸牸寮忥紝閮戒娇鐢ㄧ浉鍚岀殑鏍煎紡瀛樺偍
 				switchDateAttrOnOrder(templateVO, orderDTO);
+				//6. 鍒ゆ柇蹇呰緭椤�
+				checkRequiredAttrOnOrder(templateVO, orderDTO, errorMap);
+				//7.鍒ゆ柇鍏抽敭灞炴��
+				checkKeyAttrOnOrder(classifyFullInfo, templateVO, orderDTO, errorMap);
 				//榛樿鐨勫唴瀹逛笉鑳藉彉锛屾墍浠ュ彧闇�瑕佹嫹璐濊嚜瀹氫箟鐨勭浉鍏冲睘鎬у嵆鍙�
 				copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, true, errorMap);
 				//浼佷笟鐮佸拰闆嗗洟鐮佺殑涓嶄慨鏀�
@@ -2398,12 +2398,20 @@
 				cbo.setName(orderDTO.getName());
 				try {
 					cbo.setAttributeValueWithNoCheck("description", orderDTO.getDescription());
-					cbo.setAttributeValue("name", orderDTO.getName());
+				//	cbo.setAttributeValue("name", orderDTO.getName());
 					//  if(finalIsProcess){//鍦ㄦ祦绋嬩腑涓嶅厑璁告洿鏀�
 					//     errorMap.put(code,errorMap.getOrDefault(code, errorMap.getOrDefault(code,"")+";鏁版嵁"+code+"鍦ㄦ祦绋嬩腑锛屼笉鍏佽鏇存敼!"));
 					//  }else{
+					Date date=new Date();
 					cbo.setLcStatus(status);
 					cbo.setAttributeValue("lcstatus",status);
+					cbo.setLastModifyTime(date);
+					cbo.setLastModifier(lastModifier);
+					cbo.setLastModifyTime(date);
+					cbo.setAttributeValue("lastmodifier",lastModifier);
+					cbo.setAttributeValue("lastmodifytime",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(date));
+					cbo.setTs(date);
+					cbo.setAttributeValue("ts",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(date));
 					//  }
 				} catch (VciBaseException e) {
 					e.printStackTrace();
@@ -3699,7 +3707,7 @@
 	 */
 	private void batchCheckRequiredAttrOnOrder(CodeClassifyTemplateVO templateVO,List<ClientBusinessObject> cboList,Map<String,String> errorMap){
 		Map<String, CodeClassifyTemplateAttrVO> requiredAttrMap = templateVO.getAttributes().stream().filter(s ->
-			VciBaseUtil.getBoolean(s.getRequireFlag()) && StringUtils.isBlank(s.getComponentRule()) && StringUtils.isBlank(s.getClassifyInvokeLevel())//涓嶈兘鏄粍鍚堢殑鍜屽垎绫绘敞鍏ョ殑
+			VciBaseUtil.getBoolean(s.getRequireFlag()) && StringUtils.isBlank(s.getComponentRule()) && (StringUtils.isBlank(s.getClassifyInvokeLevel())||s.getClassifyInvokeLevel().equals("none"))//涓嶈兘鏄粍鍚堢殑鍜屽垎绫绘敞鍏ョ殑
 		).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
 		//涓嶮dmEngineServiceImpl閲岄潰鐨刢heckRequiredAttrOnOrder 閫昏緫搴旇鐩镐技
 		if(!CollectionUtils.isEmpty(requiredAttrMap)) {
@@ -3741,7 +3749,8 @@
 							}
 						}
 						CodeClassifyFullInfoBO newClassifyFullInfo= classifyFullInfoMap.get(cbo.getAttributeValue(CODE_CLASSIFY_OID_FIELD));
-						List<CodeClassifyVO> classifyVOS = newClassifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList());
+						List<CodeClassifyVO> classifyVOS = newClassifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> -o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList());
+
 						int level = VciBaseUtil.getInt(attrVO.getClassifyInvokeLevel());
 						if (classifyVOS.size()>=level && level > 0 ) {
 							classifyVO = classifyVOS.get(level-1);

--
Gitblit v1.9.3