From 2d014981bfa74a5653456349dc6dcd229f18c7a2 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 06 八月 2024 11:54:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
index 58a4810..2c23e3f 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
@@ -12,6 +12,7 @@
 import com.vci.corba.omd.ltm.LinkType;
 import com.vci.corba.omd.ltm.LinkTypeServicePrx;
 import com.vci.dto.OsAttributeDTO;
+import com.vci.omd.constants.AttributeConstants;
 import com.vci.omd.constants.LinkTypeConstants;
 import com.vci.omd.utils.ObjectTool;
 import com.vci.pagemodel.*;
@@ -47,7 +48,10 @@
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -692,6 +696,62 @@
         FileUtil.del(defaultTempFolder + File.separator);
         return BaseResult.success("閾炬帴绫诲瀷瀵煎叆鎴愬姛锛�");
     }
+    /**
+     * 鑾峰彇閾炬帴绫诲瀷鍖呭惈鐨勫睘鎬�
+     * @param name 閾炬帴绫诲瀷鐨勭紪鍙�
+     * @return 灞炴�х殑淇℃伅
+     */
+    @Override
+    public List<OsLinkTypeAttributeVO> getAllAttributeByLink(String name) throws PLException, ParseException {
+        AttributeDef[] attributes = platformClientUtil.getLinkTypeService().getAttributes(name);
+        Map<String, AttributeDef> collect = Arrays.stream(platformClientUtil.getLinkTypeService().getSysAttributeDefs())
+                .collect(Collectors.toMap(str -> str.name, str -> str));
+
+        List<OsLinkTypeAttributeVO> links = new ArrayList<>();
+        String[] sysAttibutes = { "OID", "Creator", "CreateTime", "LastModifier", "LASTMODIFYTIME", "F_OID",
+                "F_REVISIONOID", "F_NAMEOID", "F_BtwName", "T_OID", "T_REVISIONOID", "T_NAMEOID", "T_BtwName", "TS" };
+        for (String sysname : sysAttibutes) {
+            AttributeDef sysAttributeDef = collect.get(sysname.toLowerCase());
+            OsLinkTypeAttributeVO vo = new OsLinkTypeAttributeVO();
+            vo.setOid(sysAttributeDef.oid);
+            vo.setAttrDataType(sysAttributeDef.vtDataType);
+            vo.setPkLinkType(name);
+            vo.setCreateTime(new Date(sysAttributeDef.createTime));
+            vo.setCreator(sysAttributeDef.creator);
+            vo.setDefaultValue(sysAttributeDef.defValue);
+            vo.setDescription(sysAttributeDef.description);
+            vo.setRange(sysAttributeDef.rage);
+            vo.setId(sysname);
+            vo.setName(sysAttributeDef.label);
+            vo.setLastModifier(sysAttributeDef.modifier);
+            vo.setLastModifyTime(new Date(sysAttributeDef.modifyTime));
+            links.add(vo);
+        }
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        for (AttributeDef attribute : attributes) {
+            OsLinkTypeAttributeVO vo = new OsLinkTypeAttributeVO();
+            vo.setOid(attribute.oid);
+            vo.setAttrDataType(attribute.vtDataType);
+            vo.setPkLinkType(name);
+            vo.setCreateTime(new Date(attribute.createTime));
+            vo.setCreator(attribute.creator);
+            vo.setDefaultValue(attribute.defValue);
+            vo.setDescription(attribute.description);
+            vo.setRange(attribute.rage);
+            vo.setId(attribute.name);
+            vo.setName(attribute.label);
+            vo.setTs(formatter.parse(attribute.ts));
+            vo.setLastModifier(attribute.modifier);
+            vo.setOwner(attribute.creator);
+            vo.setLastModifyTime(new Date(attribute.modifyTime));
+            String maxLength = AttributeConstants.getOtherValueByType(attribute.other, AttributeConstants.LENGTH);
+            if(StringUtils.isNotBlank(maxLength)){
+                vo.setAttributeLength(Integer.valueOf(maxLength));
+            }
+            links.add(vo);
+        }
+        return links;
+    }
 
     /**
      * 淇閾炬帴绫诲瀷鐨剎ml鏂囦欢

--
Gitblit v1.9.3