From 694e0068d20b7b9cc7f2fcc2021bf83765d3799f Mon Sep 17 00:00:00 2001 From: ludc <ludc@vci-tech.com> Date: 星期四, 26 十二月 2024 11:22:09 +0800 Subject: [PATCH] 去掉不需要的一些配置文件,修改pom打包插件 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java | 133 +++++++++++++++++++++++++++++++------------ 1 files changed, 95 insertions(+), 38 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 ec96cc5..fbbf6db 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 @@ -4,19 +4,17 @@ import com.vci.client.common.datatype.VTInteger; import com.vci.client.common.datatype.VTLong; import com.vci.client.common.datatype.VTString; -import com.vci.client.mw.ClientSessionUtility; +import com.vci.common.utility.ObjectUtility; import com.vci.corba.common.PLException; import com.vci.corba.omd.atm.AttributeDef; -import com.vci.corba.omd.ltm.LinkType; -import com.vci.corba.omd.vrm.VersionRule; import com.vci.dto.OsAttributeDTO; -import com.vci.dto.OsEnumDTO; -import com.vci.dto.OsEnumItemDTO; +import com.vci.enumpck.UI.ItemTypeEnum; +import com.vci.model.OsAttributeDO; import com.vci.omd.dataType.VTDataType; import com.vci.omd.objects.OtherInfo; -import com.vci.pagemodel.*; +import com.vci.pagemodel.OsAttributeVO; +import com.vci.pagemodel.OsEnumVO; 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; @@ -27,14 +25,11 @@ import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.*; import com.vci.starter.web.util.*; -import com.vci.model.OsAttributeDO; import com.vci.web.enumpck.PortalVITypeFlag; -import com.vci.web.properties.UsedNames; import com.vci.web.service.OsAttributeServiceI; -import com.vci.web.service.OsBaseServiceI; import com.vci.web.service.OsEnumServiceI; import com.vci.web.service.OsLinkTypeServiceI; -import com.vci.web.util.Func; +import com.vci.starter.web.util.Lcm.Func; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; @@ -45,16 +40,12 @@ 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.*; import java.io.File; import java.util.*; -import java.util.List; import java.util.stream.Collectors; +import java.util.stream.Stream; -//import static com.vci.client.omd.attribpool.ui.VTDataTypePanel.*; import static com.vci.omd.constants.AttributeConstants.*; /** @@ -89,14 +80,22 @@ private Integer NAME_MAX_LENGTH = 28; /** - * 绯荤粺涓彉閲忛厤缃枃浠朵腑閰嶇疆鐨刱ey + * 鏁版嵁搴撲腑鐨勪竴浜涘叧閿瓧 */ - private final String SYSUSEDNAMES = "sysUsedNames"; - - /** - * 鏁版嵁搴撲腑鍏抽敭瀛楅厤缃枃浠朵腑閰嶇疆鐨刱ey - */ - private final String DATABASEUSEDNAMES = "dataBaseUsedNames"; + private final List<String> DATABASEUSEDNAMELIST = Arrays.asList( + "ACCESS", "ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUDIT", "BETWEEN", + "BY", "CHAR", "CHECK", "CLUSTER", "COLUMN", "COMMENT", "COMPRESS", "CONNECT", + "CREATE", "CURRENT", "DATE", "DECIMAL", "DEFAULT", "DELETE", "DESC", "DISTINCT", + "DROP", "ELSE", "EXCLUSIVE", "EXISTS", "FILE", "FLOAT", "FOR", "FROM", "GRANT", "GROUP", + "HAVING", "IDENTIFIED", "IMMEDIATE", "IN", "INCREMENT", "INDEX", "INITIAL", + "INSERT", "INTEGER", "INTERSECT", "INTO", "IS", "LEVEL", "LIKE", "LOCK", "LONG", + "MAXEXTENTS", "MINUS", "MLSLABEL", "MODE", "MODIFY", "NOAUDIT", "NOCOMPRESS", + "NOT", "NOWAIT", "NULL", "NUMBER", "OF", "OFFLINE", "ON", "ONLINE", "OPTION", "OR", "ORDER", + "P", "CTFREE", "PRIOR", "PRIVILEGES", "PUBLIC", "RAW", "RENAME", "RESOURCE", "REVOKE", + "ROW", "ROWID", "ROWNUM", "ROWS", "SELECT", "SESSION", "SET", "SHARE", "SIZE", "SMALLINT", + "START", "SUCCESSFUL", "SYNONYM", "SYSDATE", "TABLE", "THEN", "TO", "TRIGGER", "UID", "UNION", + "UNIQUE", "UPDATE", "USER", "VALIDATE", "VALUES", "VARCHAR", "VARCHAR2", "VIEW", + "WHENEVER", "WHERE", "WITH"); /** * 閾炬帴绫诲瀷鏈嶅姟 @@ -165,7 +164,7 @@ } /** - * 澶熺潃灞炴�ф爲鑺傜偣 + * 鏋勯�犲睘鎬ф爲鑺傜偣 * @param parentTreeList * @param refTypeName * @param refFlag @@ -226,7 +225,6 @@ pTree.setExpanded(true); } } - } /** @@ -340,13 +338,20 @@ attributeVO.setLastModifyTime(new Date(attribItem.modifyTime)); attributeVO.setTs(VciDateUtil.str2Date(attribItem.ts,VciDateUtil.DateTimeMillFormat)); }catch (Throwable e){ - + e.printStackTrace(); + String errorLog = "灞炴�O杞琕O鏃跺嚭閿欙紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + logger.error(errorLog); + throw new VciBaseException(errorLog); } attributeVO.setLastModifier(attribItem.modifier); attributeVO.setName(attribItem.label); attributeVO.setDescription(attribItem.description); attributeVO.setAttributeDataType(attribItem.vtDataType); attributeVO.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(attribItem.vtDataType)); + //鑾峰彇UI灞炴�х被鍨� + attributeVO.setAttributeUIType(ItemTypeEnum.convertAttributeTypeTOUITypeTextByValue(attribItem.vtDataType,false)); + //鑾峰彇UI灞炴�х被鍨嬫枃鏈� + attributeVO.setAttributeUITypeText(ItemTypeEnum.convertAttributeTypeTOUITypeTextByValue(attribItem.vtDataType,true)); attributeVO.setDefaultValue(attribItem.defValue); if(Func.isNotBlank(attribItem.rage)){ attributeVO.setRange(attribItem.rage.replace("<","<")); @@ -512,6 +517,32 @@ } /** + * 浣跨敤灞炴�х紪鍙疯幏鍙栧璞�--鎵归噺 + * + * @param attrCodes 灞炴�х殑鑻辨枃鍚嶇О + * @param attributeVOMap 灞炴�у璞� + * @return 灞炴�х殑鏄剧ず瀵硅薄 + */ + @Override + public List<OsAttributeVO> listAttrByIds(Collection<String> attrCodes,Map<String, OsAttributeVO> attributeVOMap) { + if(CollectionUtils.isEmpty(attrCodes)){ + return null; + } + if(attributeVOMap == null){ + attributeVOMap = self.selectAllAttributeMap(); + } + List<OsAttributeVO> attributeVOS = new ArrayList<>(); + Map<String, OsAttributeVO> finalAttributeVOMap = attributeVOMap; + attrCodes.stream().forEach(attrCode->{ + OsAttributeVO attributeVO = finalAttributeVOMap.getOrDefault(attrCode.toLowerCase(),null); + if(attributeVO!=null){ + attributeVOS.add(attributeVO); + } + }); + return attributeVOS; + } + + /** * 鎵归噺娣诲姞灞炴�� * * @param attribItemList 灞炴�х殑鍒楄〃 @@ -607,9 +638,10 @@ //妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰� checkDefValue(osAttributeDTO); boolean compatible = isCompatible(osAttributeVO,osAttributeDTO); - boolean hasInstance = hasInstance(osAttributeDTO.getName()); - //浜х敓鏁版嵁, 骞朵笖涓嶅吋瀹� - if(hasInstance && !compatible){ + //boolean hasInstance = hasInstance(osAttributeDTO.getId()); //涓嶅垽鏂槸鍚︿骇鐢熸暟鎹彧瑕佽寮曠敤灏遍渶瑕佽繘涓�姝ュ垽鏂被鍨嬫槸鍚﹀吋瀹� + boolean checkAttrIsUse = this.checkAttrIsUse(osAttributeDTO.getId()); + //TODO锛氭寜鐓т互鍓嶆搷浣滈厤缃枃妗d腑鐨勯�昏緫搴旇鏄細涓嶈鏄惁浜х敓鏁版嵁鍙琚紩鐢ㄥ氨闇�瑕佽鍒ゆ柇绫诲瀷鏄惁鍏煎锛堝VTString涓嶈兘杞负VTIntger鎴朧TLong锛� + if(checkAttrIsUse/*hasInstance*/ && !compatible){ throw new PLException("500",new String[]{"鏃犳晥鍙樻洿, 涓嶅吋瀹瑰凡浜х敓鐨勬暟鎹紒"}); } String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); @@ -762,6 +794,26 @@ } /** + * 鏌ョ湅灞炴�ф槸鍚﹁寮曠敤 + * @param abName + * @return false鏈寮曠敤 true琚紩鐢� + */ + private boolean checkAttrIsUse(String abName) throws PLException { + if(Func.isBlank(abName)){ + return false; + } + String[] btNames = platformClientUtil.getBtmService().getBTNamesByAPName(abName); + if(Func.isNotEmpty(btNames)){ + return true; + } + String[] ltNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(abName); + if(Func.isNotEmpty(ltNames)){ + return true; + } + return false; + } + + /** * 妫�鏌ュ睘鎬у悕绉版槸鍚︾鍚堣鑼� * @param attributeName * @return 娌℃湁杩斿洖鍊硷紝瀛樺湪闂鐩存帴鎶涘嚭閿欒 @@ -870,10 +922,14 @@ * @param abName * @return */ - private boolean usedBySystem(String abName) { + private boolean usedBySystem(String abName) throws PLException { boolean flag = false; - String[] names = UsedNames.getProperty(SYSUSEDNAMES).toUpperCase().split(","); - List<String> nameList = Arrays.asList(names); + AttributeDef[] sysAttributeDefs = platformClientUtil.getBtmService().getSysAttributeDefs(); + List<String> nameList = null; + if(Func.isNotEmpty(sysAttributeDefs)){ + nameList = Arrays.stream(sysAttributeDefs) + .map(item -> item.name.toUpperCase(Locale.ROOT)).collect(Collectors.toList()); + } if(nameList.contains(abName.toUpperCase())){ flag = true; } @@ -887,9 +943,7 @@ */ private boolean usedByDataBase(String abName){ boolean flag = false; - String[] names = UsedNames.getProperty(DATABASEUSEDNAMES).toUpperCase().split(","); - List<String> nameList = Arrays.asList(names); - if(nameList.contains(abName.toUpperCase())){ + if(DATABASEUSEDNAMELIST.contains(abName.toUpperCase())){ flag = true; } return flag; @@ -942,11 +996,14 @@ throw new PLException("500",new String[]{"璇烽�夋嫨瑕佹煡璇㈠簲鐢ㄨ寖鍥寸殑灞炴��!"}); } String[] btNames = platformClientUtil.getBtmService().getBTNamesByAPName(attributeName); - if(Func.isEmpty(btNames)){ + String[] ltNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(attributeName); + String[] mergedArray = Stream.concat(Stream.of(btNames), Stream.of(ltNames)).toArray(String[]::new); + + if(Func.isEmpty(mergedArray)){ return new ArrayList<>(); } List<Map<String,String>> btmNameMapList = new ArrayList<>(); - Arrays.stream(btNames).forEach(btName->{ + Arrays.stream(mergedArray).forEach(btName->{ Map<String, String> itemMap = new HashMap<>(); itemMap.put("attributeName",attributeName); itemMap.put("source",btName); @@ -1166,7 +1223,7 @@ } osAttributeDTO.setBtmTypeId(osAttributePO.getEnumId()); } - osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT)); + osAttributeDTO.setOid(ObjectUtility.getNewObjectID36()); osAttributeDTO.setId(osAttributePO.getId()); osAttributeDTO.setName(osAttributePO.getName()); osAttributeDTO.setDescription(osAttributePO.getDescription()); -- Gitblit v1.9.3