From 34c25ddf37a3eb8da9efb04efedad089f13efe83 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 24 七月 2024 18:20:27 +0800
Subject: [PATCH] 部门导入调整,按照部门名称/实现层级关系。枚举导入功能接口上传,属性池添加新增、查询、修改、导出、查看应用范围等接口。业务类型、链接类型、枚举类型增加等接口属性是否产生数据检查、根据属性名修改业务类型和连接类型中对应属性方法,以及属性池中需要的一些下拉查询接口。

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java |  101 ++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 89 insertions(+), 12 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 330c7d1..53145ae 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
@@ -1,7 +1,11 @@
 package com.vci.web.service.impl;
 
 import com.vci.corba.common.PLException;
+import com.vci.corba.omd.atm.AttributeDef;
+import com.vci.corba.omd.data.BusinessObject;
 import com.vci.corba.omd.ltm.LinkType;
+import com.vci.omd.utils.ObjectTool;
+import com.vci.pagemodel.*;
 import com.vci.starter.web.annotation.log.VciUnLog;
 import com.vci.starter.web.enumpck.VciFieldTypeEnum;
 import com.vci.starter.web.pagemodel.BaseQueryObject;
@@ -9,9 +13,7 @@
 import com.vci.starter.web.util.BeanUtil;
 import com.vci.starter.web.util.VciBaseUtil;
 import com.vci.starter.web.util.VciDateUtil;
-import com.vci.web.constant.CacheKeyConstant;
-import com.vci.web.model.OsLinkTypeDO;
-import com.vci.web.pageModel.*;
+import com.vci.model.OsLinkTypeDO;
 import com.vci.web.service.*;
 import com.vci.web.util.PlatformClientUtil;
 import com.vci.web.util.WebUtil;
@@ -19,16 +21,12 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import java.util.*;
 import java.util.stream.Collectors;
-
-import static com.vci.web.constant.CacheNameConstant.VCI_OBJECT_SERVICE;
 
 /**
  * 閾炬帴绫诲瀷鏈嶅姟
@@ -103,7 +101,6 @@
      */
     @Override
     @VciUnLog
-    @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_Link,unless = "#result == null")
     public Map<String, OsLinkTypeVO> selectAllLinkMap() {
         return Optional.ofNullable(self.selectAllLink()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1));
     }
@@ -276,11 +273,11 @@
                     "inner JOIN user_col_comments c on t.TABLE_NAME  = c.table_name and t.COLUMN_NAME = c.column_name where " +
                     "t.table_name = '" + VciBaseUtil.getTableName(btmTypeVO.getId()).toUpperCase(Locale.ROOT) + "' order by t.column_name asc";
             Map<String, OsBtmTypeAttributeVO> attributeVOMap = btmTypeVO.getAttributes().stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t));
-            List<com.vci.client.bof.ClientBusinessObject> cbosList = boService.queryBySql(sql, new HashMap<>());
+            List<BusinessObject> cbosList = boService.queryBySql(sql, new HashMap<>());
             if(!CollectionUtils.isEmpty(cbosList)){
                 cbosList.stream().forEach(cbo->{
-                    String attrId = cbo.getAttributeValue("column_name");
-                    String dataType = cbo.getAttributeValue("data_type");
+                    String attrId = ObjectTool.getBOAttributeValue(cbo,"column_name");
+                    String dataType = ObjectTool.getBOAttributeValue(cbo,"data_type");
                     if(StringUtils.isNotBlank(dataType) && dataType.contains("(")){
                         dataType = dataType.substring(0,dataType.indexOf("("));
                     }
@@ -328,8 +325,88 @@
      * 娓呴櫎缂撳瓨
      */
     @Override
-    @CacheEvict(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_Link)
     public void clearCache() {
 
     }
+
+    /**
+     * 淇敼閾炬帴绫诲瀷涓搴斿睘鎬у悕鐨勫睘鎬�
+     * @param apName
+     * @return
+     * @throws PLException
+     */
+    @Override
+    public boolean alterAp(String apName) throws PLException {
+        String[] linkNames = null;
+        List<String> linkNameList = new ArrayList<String>();
+        AttributeDef abItem = null;
+        try {
+            abItem = platformClientUtil.getAttributeService().getAttributeDefByName(apName);
+        } catch (PLException e1) {
+            e1.printStackTrace();
+        }
+        if(abItem == null || abItem.equals("")){
+            return true;
+        }
+        try {
+            linkNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(apName);
+        } catch (PLException e) {
+            e.printStackTrace();
+        }
+        if(linkNames == null || linkNames.length <= 0){
+            return true;
+        }
+
+        linkNameList = Arrays.asList(linkNames);
+        for(Iterator<String> i = linkNameList.iterator(); i.hasNext();){
+            String linkName = i.next();
+            try {
+                platformClientUtil.getLinkTypeService().modifyLTAttribute(linkName, apName);
+            } catch (PLException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+                String erreMsg = "璋冩暣閾炬帴绫诲瀷涓��"+apName+"銆戝睘鎬ф椂鍑虹幇閿欒锛屽師鍥狅細"+e.getMessage();
+                logger.error(erreMsg);
+                throw new PLException("500",new String[]{erreMsg});
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 鍒ゆ柇璇ュ睘鎬ф槸鍚﹀凡缁忓湪閾炬帴绫诲瀷涓骇鐢熶簡鏁版嵁
+     * @param abName
+     * @return
+     * @throws PLException
+     */
+    @Override
+    public boolean hasInstance(String abName) throws PLException {
+        String[] btmNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(abName);
+        if(btmNames == null || btmNames.length == 0){
+            return false;
+        }
+        for(int i = 0; i < btmNames.length; i++){
+            String btmName = btmNames[i];
+            boolean flag;
+            flag = platformClientUtil.getLinkTypeService().hasData(btmName);
+            if(flag){
+                return flag;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 鑾峰彇杩炴帴绫诲瀷鍚嶇О闆嗗悎
+     * @return
+     */
+    @Override
+    public List<String> getAllLtName() throws PLException {
+        LinkType[] linkTypes = platformClientUtil.getLinkTypeService().getLinkTypes();
+        if(null != linkTypes && linkTypes.length > 0){
+            return Arrays.stream(linkTypes).map(linkType -> linkType.name).collect(Collectors.toList());
+        }
+        return null;
+    }
+
 }

--
Gitblit v1.9.3