From fb4762049abdca953db1ed4528d128dd8d887710 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 08 十一月 2023 18:53:45 +0800
Subject: [PATCH] 代码提交

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 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 4696e02..28ca14e 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;
@@ -397,9 +398,9 @@
 			LinkedList<WriteExcelData> excelDataList = new LinkedList<>();
 			Workbook workbook = new HSSFWorkbook();
 			if(isHistory){
-				excelDataList.add(new WriteExcelData(0,0,"鍒嗙被璺緞"));
-				excelDataList.add(new WriteExcelData(0,1,"鐮佹瀹藉害"));
-				excelDataList.add(new WriteExcelData(0,2,!CollectionUtils.isEmpty(idAttrVOList)?idAttrVOList.get(0).getName():"浼佷笟缂栫爜"));
+				excelDataList.add(new WriteExcelData(0,0,"鍒嗙被璺緞",""));
+				excelDataList.add(new WriteExcelData(0,1,"鐮佹瀹藉害",""));
+				excelDataList.add(new WriteExcelData(0,2,!CollectionUtils.isEmpty(idAttrVOList)?idAttrVOList.get(0).getName():"浼佷笟缂栫爜",idAttrVOList.get(0).getId()));
 			}
 			for (int i = 0; i < templateAttrVOS.size(); i++) {
 				CodeClassifyTemplateAttrVO attrVO = templateAttrVOS.get(i);
@@ -407,7 +408,7 @@
 				Object text = attrVO.getName();
 				text = exportKeyAndRequired(workbook,attrVO,text);
 				int colIndex = (isHistory?3:0) + i;
-				WriteExcelData excelData = new WriteExcelData(0, colIndex, text);
+				WriteExcelData excelData = new WriteExcelData(0, colIndex, text,attrVO.getId());
 				if(StringUtils.isNotBlank(attrVO.getCodeDateFormat())
 					|| VciFieldTypeEnum.VTDateTime.name().equalsIgnoreCase(attrVO.getAttributeDataType())
 					|| VciFieldTypeEnum.VTDate.name().equalsIgnoreCase(attrVO.getAttributeDataType())
@@ -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)) {
@@ -1138,7 +1140,6 @@
 	 * @param currentTemplateVO
 	 * @param templateColumnVOMap
 	 */
-
 	private void createTemplate(CodeClassifyTemplateVO currentTemplateVO,Map<String,List<ColumnVO>>templateColumnVOMap){
 
 		List<CodeClassifyTemplateAttrVO> templateAttrVOS = currentTemplateVO.getAttributes().stream().filter(s ->
@@ -1749,7 +1750,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);
 			}
@@ -2364,6 +2366,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("鏁版嵁涓嶆槸鏈�鏂扮殑锛屽彲鑳戒粬浜哄凡缁忎慨鏀癸紝璇峰埛鏂板悗鍐嶈瘯");
@@ -2394,12 +2397,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();
@@ -2936,7 +2947,7 @@
 						for (int j = 0; j < ruleVO.getSecVOList().size(); j++) {
 							CodeBasicSecVO secVO = ruleVO.getSecVOList().get(j);
 							String length= secValues[j];
-							if(StringUtils.isNotBlank(secVO.getCodeSecLength())&&VciBaseUtil.getInt(length)>VciBaseUtil.getInt(secVO.getCodeSecLength())){
+							if(StringUtils.isNotBlank(secVO.getCodeSecLength())&&VciBaseUtil.getInt(length)>(VciBaseUtil.getInt(secVO.getCodeSecLength())+((secVO.getPrefixCode()+secVO.getSuffixCode()).length()))){
 								errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";鐮佹瀹藉害涓庣郴缁熶腑鐨勭紪鐮佽鍒欎笉鍚�" );
 								fined = true;
 								break;
@@ -3737,7 +3748,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