From 887824662344ef267e171dbfae2b8ef2145a61c6 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 26 七月 2024 10:45:17 +0800
Subject: [PATCH] 属性池所有接口完善上传(待联调)

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java |  216 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 193 insertions(+), 23 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
index b2d484d..2d0e461 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -8,17 +8,24 @@
 import com.vci.corba.common.PLException;
 import com.vci.corba.omd.atm.AttributeDef;
 import com.vci.dto.OsAttributeDTO;
+import com.vci.dto.OsEnumDTO;
+import com.vci.dto.OsEnumItemDTO;
 import com.vci.omd.dataType.VTDataType;
 import com.vci.pagemodel.OsEnumItemVO;
 import com.vci.pagemodel.OsEnumVO;
 import com.vci.pagemodel.OsUsedAttributeVO;
+import com.vci.po.OsAttributePO;
+import com.vci.po.OsEnumPO;
+import com.vci.starter.poi.bo.ReadExcelOption;
 import com.vci.starter.poi.bo.WriteExcelData;
 import com.vci.starter.poi.bo.WriteExcelOption;
+import com.vci.starter.poi.constant.ExcelLangCodeConstant;
 import com.vci.starter.poi.util.ExcelUtil;
 import com.vci.starter.web.annotation.log.VciUnLog;
 import com.vci.starter.web.enumpck.VciFieldTypeEnum;
 import com.vci.starter.web.exception.VciBaseException;
 import com.vci.starter.web.pagemodel.BaseQueryObject;
+import com.vci.starter.web.pagemodel.BaseResult;
 import com.vci.starter.web.pagemodel.DataGrid;
 import com.vci.starter.web.util.*;
 import com.vci.model.OsAttributeDO;
@@ -31,12 +38,14 @@
 import com.vci.web.util.PlatformClientUtil;
 import com.vci.web.util.WebUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.util.HSSFColor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.swing.*;
 import java.awt.*;
@@ -102,6 +111,11 @@
 	@Autowired(required = false)
 	@Lazy
 	private OsBtmServiceImpl osBtmService;
+
+	/**
+	 *  蹇呭~鍒�
+	 */
+	private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
 
 	/**
 	 * 榛樿鐨勫睘鎬�
@@ -185,7 +199,7 @@
 		VciBaseUtil.alertNotNull(attrNames,"灞炴�у悕");
 		List<OsAttributeVO> osAttributeVOS = new ArrayList<>();
 		for (int i = 0; i < attrNames.length; i++) {
-			AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefs(attrNames[i],1,1);
+			AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefs(attrNames[i].toLowerCase(Locale.ROOT),1,1);
 			if(Func.isNotEmpty(attributeDefs)){
 				Arrays.stream(attributeDefs).forEach(attributeDef -> {
 					osAttributeVOS.add(attributeDO2VO(attributeDef));
@@ -224,8 +238,8 @@
 			attributeVO.setId(attribItem.name);
 			attributeVO.setCreator(attribItem.creator);
 			try {
-				attributeVO.setCreateTime(VciDateUtil.str2Date(String.valueOf(attribItem.createTime),VciDateUtil.DateTimeFormat));
-				attributeVO.setLastModifyTime(VciDateUtil.str2Date(String.valueOf(attribItem.modifyTime),VciDateUtil.DateTimeFormat));
+				attributeVO.setCreateTime(new Date(attribItem.createTime));
+				attributeVO.setLastModifyTime(new Date(attribItem.modifyTime));
 				attributeVO.setTs(VciDateUtil.str2Date(attribItem.ts,VciDateUtil.DateTimeMillFormat));
 			}catch (Throwable e){
 
@@ -236,7 +250,11 @@
 			attributeVO.setAttributeDataType(attribItem.vtDataType);
 			attributeVO.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(attribItem.vtDataType));
 			attributeVO.setDefaultValue(attribItem.defValue);
-			attributeVO.setRange(attribItem.rage);
+			if(Func.isNotBlank(attribItem.rage)){
+				attributeVO.setRange(attribItem.rage.replace("&lt;","<"));
+			}else{
+				attributeVO.setRange(attribItem.rage);
+			}
 			attributeVO.setOther(attribItem.other);
 			//澶勭悊鍙傜収鐩稿叧灞炴��
 			if(StringUtils.isNotBlank(attribItem.other)) {
@@ -248,6 +266,12 @@
 							attributeVO.setBtmTypeId(s.split("=")[1].trim());
 						}
 						//閾炬帴绫诲瀷涓嶆敮鎸�
+						if (s.toLowerCase().contains("link") && s.split("=").length > 1) {//蹇呴』瑕佸垽鏂暱搴︼紝鍥犱负鏋氫妇鐨勬椂鍊欎篃鏄寘鍚繖涓猙tm鐨�
+							attributeVO.setLinkTypeName(s.split("=")[1].trim());
+						}
+						if (s.toLowerCase().contains("version") && s.split("=").length > 1) {//蹇呴』瑕佸垽鏂暱搴︼紝鍥犱负鏋氫妇鐨勬椂鍊欎篃鏄寘鍚繖涓猙tm鐨�
+							attributeVO.setVersion(WebUtil.getInt(s.split("=")[1].trim()));
+						}
 					}
 				}
 				//蹇呰緭鍜岄暱搴�
@@ -453,6 +477,7 @@
 		//妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰�
 		checkDefValue(osAttributeDTO);
 		//dto瀵硅薄杞崲涓哄瓨鍌ㄦ墍闇�瀵硅薄
+		osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
 		AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO);
 		return platformClientUtil.getAttributeService().addAttributeDef(attributeDef);
 	}
@@ -486,7 +511,7 @@
 		if(hasInstance && !compatible){
 			throw new PLException("500",new String[]{"鏃犳晥鍙樻洿, 涓嶅吋瀹瑰凡浜х敓鐨勬暟鎹紒"});
 		}
-		String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
+		String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
 		osAttributeDTO.setLastModifier(userId);
 		osAttributeDTO.setCreator(osAttributeVO.getCreator());
 		osAttributeDTO.setCreateTime(osAttributeVO.getCreateTime());
@@ -519,16 +544,22 @@
 	 */
 	private AttributeDef osAttributeDTO2AttributeDef(OsAttributeDTO osAttributeDTO) {
 		AttributeDef attributeDef = new AttributeDef();
+		attributeDef.oid = osAttributeDTO.getOid();
 		attributeDef.name = osAttributeDTO.getId().toLowerCase().replaceAll(" ", "");
 		attributeDef.label = osAttributeDTO.getName();
 		attributeDef.description = osAttributeDTO.getDescription();
 		attributeDef.vtDataType = (String)osAttributeDTO.getAttributeDataType();
 		attributeDef.defValue = Func.isBlank(osAttributeDTO.getDefaultValue()) ? "" : osAttributeDTO.getDefaultValue();
-		attributeDef.rage = Func.isBlank(osAttributeDTO.getRange()) ? "" : osAttributeDTO.getRange();
-		attributeDef.creator = Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
+		if(Func.isBlank(osAttributeDTO.getRange())){
+			attributeDef.rage = "";
+		}else{
+			//鐗规畩瀛楃澶勭悊锛岀洿鎺ュ瓨鍌�<浼氭姤閿�
+			attributeDef.rage = osAttributeDTO.getRange().replace("<","&lt;");
+		}
 		attributeDef.ts = Func.format((Func.isNotEmpty(osAttributeDTO.getTs()) ? osAttributeDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat);
+		attributeDef.creator = "developer";//Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
 		attributeDef.createTime = Func.isEmpty(osAttributeDTO.getCreateTime()) ? System.currentTimeMillis():osAttributeDTO.getCreateTime().getTime();
-		attributeDef.modifier = Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
+		attributeDef.modifier = "developer";//Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
 		attributeDef.modifyTime = System.currentTimeMillis();
 		//other闇�瑕佽嚜琛屽鐞�
 		StringBuffer sb = new StringBuffer();
@@ -563,9 +594,12 @@
 				break;
 			case VTString:
 				if (StringUtils.isNotBlank(osAttributeDTO.getBtmTypeId())) {
-					//鍙傜収
+					//鍙傜収涓氬姟绫诲瀷
 					sb.append(BTM).append(" = ").append(osAttributeDTO.getBtmTypeId()).append(";");
-					//閾炬帴绫诲瀷鏆傛椂涓嶆敮鎸�
+				}
+				if(StringUtils.isNotBlank(osAttributeDTO.getLinkTypeName())){
+					//鍙傜収閾炬帴绫诲瀷
+					sb.append(LINKTYPENAME).append(" = ").append(osAttributeDTO.getLinkTypeName()).append(";");
 				}
 				sb.append(LENGTH).append(" = ").append(length > osAttributeDTO.getAttrLength()?length:osAttributeDTO.getAttrLength()).append(";");
 				if (StringUtils.isNotBlank(osAttributeDTO.getEnumId())) {
@@ -636,12 +670,12 @@
 		}
 
 		if(!attributeName.matches("[a-z A-Z]*")){
-			throw new PLException("500",new String[]{"娉ㄦ剰锛氬睘鎬у悕鍙兘涓鸿嫳鏂囧瓧姣�!"+ NAME_MAX_LENGTH});
+			throw new PLException("500",new String[]{"娉ㄦ剰锛氬睘鎬у悕鍙兘涓鸿嫳鏂囧瓧姣�!"});
 		}
 
 		int length = attributeName.length();
 		if(length > NAME_MAX_LENGTH){
-			throw new PLException("500",new String[]{"灞炴�у悕杩囬暱,灞炴�у悕闀垮害涓嶈兘瓒呰繃!"+ NAME_MAX_LENGTH});
+			throw new PLException("500",new String[]{"灞炴�у悕杩囬暱,灞炴�у悕闀垮害涓嶈兘瓒呰繃"+ NAME_MAX_LENGTH});
 		}
 
 		String abName = attributeName.toLowerCase();
@@ -692,7 +726,6 @@
 				if(rages == null || rages.equals("")){
 					return;
 				}
-
 				VTInteger obj = new VTInteger(Integer.valueOf(defValue));
 				boolean flag = obj.checkRageValueByRage(rages);
 				if(!flag){
@@ -707,7 +740,6 @@
 				if(rages == null || rages.equals("")){
 					return;
 				}
-
 				VTLong obj = new VTLong(Long.valueOf(defValue));
 				boolean flag = obj.checkRageValueByRage(rages);
 				if(!flag){
@@ -727,7 +759,6 @@
 				if(!flag){
 					throw new PLException("500",new String[]{"榛樿鍊间笌鍊煎煙鍐茬獊锛�"});
 				}
-
 			}
 		}
 	}
@@ -840,7 +871,7 @@
 				Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪",
 						"灞炴�х被鍨�", "鍏佽涓虹┖", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�(鏋氫妇鍚�)",
 						"浣跨敤鐨勬灇涓句腑鏂囧悕绉�(鏍囩)", "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�", "鍙傜収鐨勪笟鍔$被鍨嬪悕绉�",
-						"灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�","鍒涘缓鏃堕棿")
+						"鍙傜収鐨勯摼鎺ョ被鍨嬪悕绉�","鐗堟湰鐗堟","灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�","鍒涘缓鏃堕棿")
 		);
 
 		//鍐檈xcel
@@ -869,7 +900,7 @@
 				excelDataList.add(new WriteExcelData(i+1,0, osAttributeVO.getId()));
 				excelDataList.add(new WriteExcelData(i+1,1, osAttributeVO.getName()));
 				excelDataList.add(new WriteExcelData(i+1,2, osAttributeVO.getDescription()));
-				excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataTypeText()+(osAttributeVO.getAttributeDataType())));
+				excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataTypeText()+"("+osAttributeVO.getAttributeDataType()+")"));
 				excelDataList.add(new WriteExcelData(i+1,4, osAttributeVO.isNullableFlag()));
 				excelDataList.add(new WriteExcelData(i+1,5, osAttributeVO.getDefaultValue()));
 				excelDataList.add(new WriteExcelData(i+1,6, osAttributeVO.getEnumId()));
@@ -877,15 +908,154 @@
 				excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getBtmTypeId()));
 				excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName()));
 				excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getAttrLength()));
-				excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getPrecisionLength()));
-				excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getScaleLength()));
-				excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getRange()));
-				excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getCreateTime()));
+				excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getLinkTypeName()));
+				excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getVersion()));
+				excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getPrecisionLength()));
+				excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getScaleLength()));
+				excelDataList.add(new WriteExcelData(i+1,15, osAttributeVO.getRange()));
+				excelDataList.add(new WriteExcelData(i+1,16, osAttributeVO.getCreateTime()));
 			}
 		}
 		WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
 		ExcelUtil.writeDataToFile(excelPath, excelOption);
 		return excelPath;
+	}
+
+	/**
+	 * 涓嬭浇灞炴�у鍏ユā鏉�
+	 * @param exportFileName
+	 * @return
+	 * @throws PLException
+	 */
+	@Override
+	public String downloadAttributeTemplate(String exportFileName) throws Exception {
+		//鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+		exportFileName = Func.isBlank(exportFileName) ?  "灞炴�ф睜瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+		//璁剧疆鍒楀悕
+		List<String> columns = new ArrayList<>(
+				Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪",
+						"灞炴�х被鍨�", "鍏佽涓虹┖(鏄�/鍚�)", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�", "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�",
+						"鍙傜収鐨勯摼鎺ョ被鍨嬬紪鍙�","鐗堟湰鐗堟","灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�")
+		);
+		//璁剧疆蹇呭~鍒�
+		ColumnNameisRed.clear();
+		ColumnNameisRed.add(0);
+		ColumnNameisRed.add(3);
+		ColumnNameisRed.add(10);
+
+		//鍐檈xcel
+		String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName +  ".xls";
+		try {
+			new File(excelPath).createNewFile();
+		} catch (Throwable e) {
+			throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
+		}
+		//璁剧疆鍒�
+		List<WriteExcelData> excelDataList = new ArrayList<>();
+		//璁剧疆鍒楀ご
+		for (int index = 0; index < columns.size(); index++) {
+			//鍒ゆ柇鏄惁涓哄繀濉垪锛岀粰蹇呭~鍒楄缃鑹�
+			if(ColumnNameisRed.contains(index)){
+				WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index));
+				excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex()));
+				excelDataList.add(excelData);
+			}else{
+				excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+			}
+		}
+		WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+		ExcelUtil.writeDataToFile(excelPath, excelOption);
+		return excelPath;
+	}
+
+	/**
+	 * 瀵煎叆灞炴��
+	 * @param file
+	 * @return
+	 */
+	@Override
+	public BaseResult importAttributes(File file) throws Exception{
+		VciBaseUtil.alertNotNull(file,"excel鏂囦欢");
+		if(!file.exists()){
+			throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()});
+		}
+		try{
+			//1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞�
+			ReadExcelOption excelOption = new ReadExcelOption();
+			List<OsAttributePO> poList = ExcelUtil.readDataObjectFromExcel(file, OsAttributePO.class,excelOption,(value, po, fieldName)->{});
+			//鍘婚櫎閮芥槸绌虹殑鎯呭喌
+			if(CollectionUtils.isEmpty(poList)){
+				return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
+			}
+			//excel鍒ら噸锛屾暟鎹牎楠岋紝dto瀵硅薄杞崲锛屽瓨鍌ㄥ璞¤浆鎹紝鎵ц淇濆瓨
+			List<OsAttributeDTO> dtoList = new ArrayList<>();
+			//褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級
+			Map<String, String> excelReapeat = new HashMap<>();
+			//鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫
+			poList.stream().forEach(osAttributePO -> {
+				if(Func.isBlank(osAttributePO.getId())){//灞炴�у悕鍒ょ┖
+					throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宔numnameerror");
+				}else if(Func.isBlank(osAttributePO.getAttributeDataType())){
+					throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宼ypeerror");
+				}else if(excelReapeat.containsKey(osAttributePO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲�
+					throw new VciBaseException("绗��"+excelReapeat.get(osAttributePO.getId())+"銆戣鍜岀銆�"+osAttributePO.getRowIndex()+"銆戣鏁版嵁锛屽睘鎬у悕閲嶅");
+				}
+				//灞炴�у悕鏍¢獙
+				try {
+					checkName(osAttributePO.getId());
+				} catch (PLException e) {
+					e.printStackTrace();
+					throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
+				}
+				//灞炴�у悕excel涓垽閲嶅鐞�
+				excelReapeat.put(osAttributePO.getId(),osAttributePO.getRowIndex());
+				OsAttributeDTO osAttributeDTO = new OsAttributeDTO();
+				osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
+				osAttributeDTO.setId(osAttributePO.getId());
+				osAttributeDTO.setName(osAttributePO.getName());
+				osAttributeDTO.setDescription(osAttributePO.getDescription());
+				osAttributeDTO.setDefaultValue(osAttributePO.getDefaultValue());
+				osAttributeDTO.setAttrLength(osAttributePO.getAttrLength());
+				osAttributeDTO.setAttributeDataType(osAttributePO.getAttributeDataType());
+				osAttributeDTO.setBtmTypeId(osAttributePO.getBtmTypeId());
+				//osAttributeDTO.setBtmTypeName(osAttributePO.getBtmname());
+				osAttributeDTO.setLinkTypeName(osAttributePO.getLinkTypeName());
+				osAttributeDTO.setVersion(osAttributePO.getVersion());
+				osAttributeDTO.setEnumId(osAttributePO.getEnumId());
+				//osAttributeDTO.setEnumName(osAttributePO.getEnumId());
+				osAttributeDTO.setPrecisionLength(osAttributePO.getPrecisionLength());
+				osAttributeDTO.setScaleLength(osAttributePO.getScaleLength());
+				osAttributeDTO.setRange(osAttributePO.getRange());
+				osAttributeDTO.setNullableFlag("鏄�".equals(osAttributePO.getNullableFlag()) ? true:false);
+				try {
+					//妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰�
+					checkDefValue(osAttributeDTO);
+				} catch (PLException e) {
+					e.printStackTrace();
+					throw new VciBaseException(e.getMessage());
+				}
+				dtoList.add(osAttributeDTO);
+			});
+			//鎵ц淇濆瓨鎿嶄綔
+			dtoList.stream().forEach(dto->{
+				try {
+					boolean b = platformClientUtil.getAttributeService().addAttributeDef(osAttributeDTO2AttributeDef(dto));
+					if(!b){
+						throw new VciBaseException("save and return false");
+					}
+				} catch (PLException e) {
+					e.printStackTrace();
+					throw new VciBaseException("鎵ц淇濆瓨鏃跺嚭鐜伴敊璇紝閿欒灞炴�у璞″悕涓猴細銆�" + dto.getId() + "銆戯紝鍘熷洜锛�"+e.getMessage());
+				}
+			});
+		}catch (Exception e){
+			if(logger.isErrorEnabled()){
+				logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e));
+			}
+			e.printStackTrace();
+			return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
+		}
+		return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�");
 	}
 
 	/**
@@ -909,11 +1079,11 @@
 	 */
 	private boolean isReferAttr(String other){
 		if(StringUtils.isNotBlank(other)
-				&& (other.toLowerCase().contains("btm") || other.toLowerCase().contains("ltm"))){
+				&& (other.toLowerCase().contains("btm") || other.toLowerCase().contains("link"))){
 			//杩樹笉鑳界‘瀹氾紝鍥犱负鏋氫妇鐨勬椂鍊欎篃浼氳缃産tm
 			String[] temp = other.split(";");
 			for(String s : temp){
-				if((s.contains("btm") || s.contains("ltm")) && s.split("=").length>1){
+				if((s.contains("btm") || s.contains("link")) && s.split("=").length>1){
 					return true;
 				}
 			}

--
Gitblit v1.9.3