From bbf34989894913f3db3f785c79d30069397ce11e Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 31 七月 2024 15:02:07 +0800
Subject: [PATCH] 属性池、状态池、枚举导出列名调整,可通过变量控制导出的列名是否和导入模板的一致;版本管理查询、查看应用范围接口上传。

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

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java
index 4adf929..7a59184 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java
@@ -1,11 +1,14 @@
 package com.vci.web.service.impl;
 
+import com.vci.client.mw.ClientSessionUtility;
 import com.vci.corba.common.PLException;
 import com.vci.corba.omd.vrm.VersionRule;
+import com.vci.dto.OsRevisionRuleDTO;
 import com.vci.starter.web.annotation.log.VciUnLog;
 import com.vci.starter.web.util.VciDateUtil;
 import com.vci.pagemodel.OsRevisionRuleVO;
 import com.vci.web.service.OsRevisionRuleServiceI;
+import com.vci.web.util.Func;
 import com.vci.web.util.PlatformClientUtil;
 import com.vci.web.util.WebUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -13,6 +16,7 @@
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
+import javax.swing.*;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -36,6 +40,7 @@
     @Autowired(required = false)
     @Lazy
     private OsRevisionRuleServiceI self;
+
     /**
      * 鏌ヨ鎵�鏈夌殑鐗堟湰瑙勫垯
      *
@@ -59,6 +64,49 @@
     @VciUnLog
     public Map<String, OsRevisionRuleVO> selectAllRevisionMap() {
         return Optional.ofNullable(self.selectAllRevision()).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(),t->t,(o1,o2)->o1));
+    }
+
+    /**
+     * 鍒涘缓鐗堟湰瑙勫垯
+     * @param osRevisionRuleDTO
+     * @return
+     */
+    @Override
+    public boolean addVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException {
+        VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getName());
+        //name涓嶄负绌�
+        if(Func.isNotEmpty(vr) && !"".equals(vr.name)){
+            throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉�!"});
+        }
+
+        platformClientUtil.getVersionService().addVersionRule(this.dto2VersionRule(osRevisionRuleDTO));
+        return false;
+    }
+
+    @Override
+    public boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) {
+
+        return false;
+    }
+
+    /**
+     * dto瀵硅薄杞崲涓篤ersionRule瀵硅薄
+     * @return
+     */
+    private VersionRule dto2VersionRule(OsRevisionRuleDTO osRevisionRuleDTO){
+        VersionRule newVR = new VersionRule();
+        newVR.name = osRevisionRuleDTO.getId();
+        newVR.tag = osRevisionRuleDTO.getName();
+        newVR.jumpCharacter = osRevisionRuleDTO.getPrefixCode();
+        /*newVR.initialValue = jtf3.getText();
+        newVR.stepLength = jtf4.getText();
+        newVR.prefixion = jtf5.getText();
+        newVR.suffix = jtf6.getText();
+        newVR.description = jta.getText();*/
+        String userName = ClientSessionUtility.getCurUserName();
+        newVR.creator = userName;
+        newVR.modifier = userName;
+        return newVR;
     }
 
     /**
@@ -125,10 +173,35 @@
     }
 
     /**
+     * 鏌ヨ搴旂敤鑼冨洿
+     * @param vrName 鐗堟湰瑙勫垯鑻辨枃鍚嶇О
+     * @return
+     */
+    @Override
+    public List<Map<String, String>> getUsedVersionRuleList(String vrName) throws PLException {
+        if(Func.isBlank(vrName)){
+            throw new PLException("500",new String[]{"璇烽�夋嫨瑕佹煡璇㈠簲鐢ㄨ寖鍥寸殑灞炴��!"});
+        }
+        String[] btNames = platformClientUtil.getBtmService().getBTNamesByVerName(vrName);
+        if(Func.isEmpty(btNames)){
+            return new ArrayList<>();
+        }
+        List<Map<String,String>> btmNameMapList = new ArrayList<>();
+        Arrays.stream(btNames).forEach(btName->{
+            Map<String, String> itemMap = new HashMap<>();
+            itemMap.put("versionRuleName",vrName);
+            itemMap.put("source",btName);
+            btmNameMapList.add(itemMap);
+        });
+        return btmNameMapList;
+    }
+
+    /**
      * 娓呴櫎缂撳瓨
      */
     @Override
     public void clearCache() {
 
     }
+
 }

--
Gitblit v1.9.3