From 5203081b68e3a8dc139d1807b2f8774e4a00a82a Mon Sep 17 00:00:00 2001
From: ludc <ludc@vci-tech.com>
Date: 星期四, 16 一月 2025 11:11:59 +0800
Subject: [PATCH] 退出登录接口增加清除session、jwttoken等缓存信息

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsRevisionRuleServiceImpl.java |  452 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 443 insertions(+), 9 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..06dcba4 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
@@ -2,17 +2,32 @@
 
 import com.vci.corba.common.PLException;
 import com.vci.corba.omd.vrm.VersionRule;
-import com.vci.starter.web.annotation.log.VciUnLog;
-import com.vci.starter.web.util.VciDateUtil;
+import com.vci.dto.OsRevisionRuleDTO;
 import com.vci.pagemodel.OsRevisionRuleVO;
+import com.vci.po.OsRevisionRulePO;
+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.exception.VciBaseException;
+import com.vci.starter.web.pagemodel.BaseResult;
+import com.vci.starter.web.util.*;
 import com.vci.web.service.OsRevisionRuleServiceI;
+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;
+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 java.io.File;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -36,6 +51,17 @@
     @Autowired(required = false)
     @Lazy
     private OsRevisionRuleServiceI self;
+
+    /**
+     * 鏃ュ織
+     */
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    /**
+     *  蹇呭~鍒�
+     */
+    private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
+
     /**
      * 鏌ヨ鎵�鏈夌殑鐗堟湰瑙勫垯
      *
@@ -59,6 +85,164 @@
     @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 {
+        //鍒ょ┖
+        VciBaseUtil.alertNotNull(osRevisionRuleDTO,"鐗堟湰瑙勫垯瀵硅薄",osRevisionRuleDTO.getId(),"鐗堟湰瑙勫垯鍚嶇О");
+        //鐗堟湰瑙勫垯鍚堣妫�楠�
+        this.checkVersionRule(osRevisionRuleDTO);
+        //鏌ラ噸
+        VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getId());
+        //name涓嶄负绌�
+        if(Func.isNotEmpty(vr) && !"".equals(vr.name)){
+            throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉�!"});
+        }
+        return platformClientUtil.getVersionService().addVersionRule(this.dto2VersionRule(osRevisionRuleDTO));
+    }
+
+    /**
+     * 淇敼鐗堟湰瑙勫垯
+     * @param osRevisionRuleDTO
+     * @return
+     */
+    @Override
+    public boolean updateVersionRule(OsRevisionRuleDTO osRevisionRuleDTO) throws PLException {
+        //鍒ょ┖
+        VciBaseUtil.alertNotNull(osRevisionRuleDTO,"鐗堟湰瑙勫垯瀵硅薄",osRevisionRuleDTO.getId(),"鐗堟湰瑙勫垯鍚嶇О");
+        //鍒ゆ柇鏄惁鍦ㄧ郴缁熶腑瀛樺湪
+        VersionRule vr = platformClientUtil.getVersionService().getVersionRule(osRevisionRuleDTO.getName());
+        //鐗堟湰瑙勫垯鍚堣妫�楠�
+        this.checkVersionRule(osRevisionRuleDTO);
+        //name涓嶄负绌�
+        if(Func.isEmpty(vr) && !"".equals(vr.name)){
+            throw new PLException("500",new String[]{"淇敼鐨勭増鏈鍒欏湪绯荤粺涓笉瀛樺湪!"});
+        }
+        return platformClientUtil.getVersionService().modifyVersionRule(this.dto2VersionRule(osRevisionRuleDTO));
+    }
+
+    /**
+     * 鍒犻櫎鐗堟湰瑙勫垯
+     * @param osRevisionRuleDTOS
+     * @return
+     */
+    @Override
+    public boolean deleteVersionRule(List<OsRevisionRuleDTO> osRevisionRuleDTOS) throws PLException {
+        VciBaseUtil.alertNotNull(osRevisionRuleDTOS,"寰呭垹闄ょ殑灞炴�у垪琛�");
+        //鍒ゆ柇瑕佸垹闄ょ殑鐗堟湰瑙勫垯鏄惁鏈夎寮曠敤
+        osRevisionRuleDTOS.stream().forEach(item->{
+            String vrName = item.getId();
+            try {
+                List<Map<String, String>> usedVersionRuleList = this.getUsedVersionRuleList(vrName);
+                if(Func.isNotEmpty(usedVersionRuleList)){
+                    throw new VciBaseException("璇ョ増鏈凡琚娇鐢ㄤ笉鍏佽鍒犻櫎");
+                }
+            } catch (PLException e) {
+                logger.error(e.getMessage());
+                e.printStackTrace();
+                throw new VciBaseException(e.getMessage());
+            }
+        });
+
+        //骞冲彴鐨刣eleteStatus鏂规硶蹇呬紶涓変釜鍙傛暟锛宱id銆乶ame鍜宼s
+        List<VersionRule> vrList = new ArrayList<>();
+        for(OsRevisionRuleDTO vrDTO : osRevisionRuleDTOS){
+            //oid鍜宼s鍒ょ┖
+            String oid = vrDTO.getOid();
+            //id涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄�
+            String id = vrDTO.getId();
+            //鍚庡彴浼氱敤ts杩涜鏁版嵁涓�鑷存�ф牎楠�
+            Date ts = vrDTO.getTs();
+            if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){
+                throw new PLException("500",new String[]{"寰呭垹闄ょ殑鐗堟湰瑙勫垯鍒楄〃涓富閿�恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佺姸鎬佸悕绉般�恘ame銆戜笉鑳戒负绌猴紒"});
+            }
+            VersionRule vr = new VersionRule();
+            vr.oid = oid;
+            vr.name = id;
+            vr.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat);
+            vrList.add(vr);
+        }
+        return platformClientUtil.getVersionService().deleteVersionRules(vrList.toArray(new VersionRule[vrList.size()]));
+    }
+
+    /**
+     * 妫�鏌ョ増鏈鍒欒缃殑鏄惁鍚堢悊
+     * @param dto
+     */
+    private void checkVersionRule(OsRevisionRuleDTO dto) throws PLException {
+        //鐗堟湰瑙勫垯鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣�
+        String regex = "[a-z A-Z]*";
+        if (!dto.getId().matches(regex)) {
+            throw new PLException("500",new String[]{"鍚嶇О鍙兘涓鸿嫳鏂囷紒"});
+        }
+        //璺宠穬瀛楃鍙兘涓烘暟瀛楁垨鑰呭瓧姣�
+        String regex0 = "^[a-zA-Z0-9,]+$";
+        if(Func.isNotBlank(dto.getJumpCharacter()) && (!(dto.getJumpCharacter().matches(regex0)))){
+            throw new PLException("500",new String[]{"璺宠穬瀛楃鍙兘涓烘暟瀛楁垨鑰呭瓧姣嶏紒"});
+        }
+        //鍒濆鍊间笉鑳戒负绌轰笖鍙兘涓烘暟瀛楁垨鑰呭瓧姣嶆垨鑻辨枃鐘舵�佷笅鐨勭鍙�
+        String regex1 = "[A-Za-z0-9!@#$%^&*()-_=+{}':|;,.?/]+$";
+        if(Func.isBlank(dto.getInitialValue()) || !dto.getInitialValue().matches(regex1)){
+            throw new PLException("500",new String[]{"鍒濆鍊间笉鑳戒负绌轰笖鍙兘涓烘暟瀛楁垨鑰呭瓧姣嶆垨鑻辨枃鐘舵�佷笅鐨勭鍙凤紒"});
+        }
+        if(dto.getInitialValue().length() + dto.getInitialValue().length() > 32) {
+            throw new PLException("500",new String[]{"鍒濆鍊间笉鑳借秴杩�32涓瓧绗︼紒"});
+        }
+        //姝ラ暱涓嶈兘涓虹┖涓斿繀椤讳负1-9鐨勬鏁存暟
+        String regex2 = "[1-9]";
+        if(Func.isBlank(dto.getStepLength()) || (!dto.getStepLength().matches(regex2))){
+            throw new PLException("500",new String[]{"姝ラ暱涓嶈兘涓虹┖涓斿繀椤讳负1-9鐨勬鏁存暟"});
+        }
+        //鍓嶇紑鐩稿叧鍒ゆ柇
+        String regex3 = "^\\s+.*";
+        if(Func.isNotBlank(dto.getPrefixion()) && (dto.getPrefixion().matches(regex3))){
+            throw new PLException("500",new String[]{"鍓嶇紑涓嶈兘浠ョ┖鏍煎紑澶�"});
+        }
+        if (Func.isNotBlank(dto.getPrefixion()) && dto.getPrefixion().length() > 32) {
+            throw new PLException("500",new String[]{"鍓嶇紑涓嶈兘瓒呰繃32涓瓧绗�"});
+        }
+        //鍚庣紑鐩稿叧鍒ゆ柇
+        String regex4 = "^*.\\s+$";
+        if(Func.isNotBlank(dto.getSuffix()) && (dto.getSuffix().matches(regex4))){
+            throw new PLException("500",new String[]{"鍚庣紑涓嶈兘浠ョ┖鏍肩粨灏�"});
+        }
+        if (Func.isNotBlank(dto.getSuffix()) && dto.getSuffix().length() > 32) {
+            throw new PLException("500",new String[]{"鍚庣紑涓嶈兘瓒呰繃32涓瓧绗�"});
+        }
+        if (dto.getId().length() > 255) {
+            throw new PLException("500",new String[]{"鍚嶇О涓嶈兘瓒呰繃255涓瓧绗�"});
+        }
+    }
+
+    /**
+     * dto瀵硅薄杞崲涓篤ersionRule瀵硅薄
+     * @return
+     */
+    private VersionRule dto2VersionRule(OsRevisionRuleDTO osRevisionRuleDTO){
+        VersionRule newVR = new VersionRule();
+        newVR.oid = osRevisionRuleDTO.getOid();
+        newVR.name = osRevisionRuleDTO.getId();
+        newVR.label = osRevisionRuleDTO.getName();
+        newVR.description = osRevisionRuleDTO.getDescription();
+        newVR.jumpCharacter = osRevisionRuleDTO.getJumpCharacter();
+        newVR.initialValue = osRevisionRuleDTO.getInitialValue();
+        newVR.stepLength = osRevisionRuleDTO.getStepLength();
+        newVR.prefixion = osRevisionRuleDTO.getPrefixion();
+        newVR.suffix = osRevisionRuleDTO.getSuffix();
+        String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
+        long timeMillis = System.currentTimeMillis();
+        newVR.ts = Func.format((Func.isNotEmpty(osRevisionRuleDTO.getTs()) ? osRevisionRuleDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat);
+        newVR.creator = Func.isBlank(osRevisionRuleDTO.getCreator()) ? userName:osRevisionRuleDTO.getCreator();
+        newVR.createTime = Func.isEmpty(osRevisionRuleDTO.getCreateTime()) ? timeMillis:osRevisionRuleDTO.getCreateTime().getTime();
+        newVR.modifier = userName;
+        newVR.modifyTime = timeMillis;
+        return newVR;
     }
 
     /**
@@ -93,18 +277,18 @@
             try {
                 ruleVO.setCreateTime(VciDateUtil.long2Date(versionRule.createTime));
                 ruleVO.setLastModifyTime(VciDateUtil.long2Date(versionRule.modifyTime));
-                ruleVO.setTs(VciDateUtil.str2Date(versionRule.ts,VciDateUtil.DateTimeFormat));
+                ruleVO.setTs(VciDateUtil.str2Date(versionRule.ts,VciDateUtil.DateTimeMillFormat));
             } catch (Exception e) {
                 e.printStackTrace();
             }
             ruleVO.setDescription(versionRule.description);
             ruleVO.setId(versionRule.name);
-            ruleVO.setName(versionRule.tag);
-            ruleVO.setSerialStep(WebUtil.getInt(versionRule.stepLength));
-            ruleVO.setSkipCode(versionRule.jumpCharacter);
-            ruleVO.setPrefixCode(versionRule.prefixion);
-            ruleVO.setSuffixCode(versionRule.suffix);
-            ruleVO.setStartCode(versionRule.initialValue);
+            ruleVO.setName(versionRule.label);
+            ruleVO.setStepLength(WebUtil.getInt(versionRule.stepLength));
+            ruleVO.setJumpCharacter(versionRule.jumpCharacter);
+            ruleVO.setPrefixion(versionRule.prefixion);
+            ruleVO.setSuffix(versionRule.suffix);
+            ruleVO.setInitialValue(versionRule.initialValue);
             //associated鏆傛椂娌℃湁浣跨敤
         }
         return ruleVO;
@@ -125,10 +309,260 @@
     }
 
     /**
+     * 浣跨敤澶氫釜缂栧彿鑾峰彇瑙勫垯鐨勫��
+     * @param vrIdList 缂栧彿
+     * @return 鏄剧ず瀵硅薄
+     */
+    @Override
+    public List<OsRevisionRuleVO> getRevisionRuleByIds(Collection<String> vrIdList) {
+        if(Func.isEmpty(vrIdList)){
+            return null;
+        }
+        Map<String, OsRevisionRuleVO> revisionRuleVOMap = self.selectAllRevisionMap();
+        List<OsRevisionRuleVO> versionRuleList = new ArrayList<>();
+        vrIdList.stream().forEach(vrId->{
+            OsRevisionRuleVO versionRuleVO = revisionRuleVOMap.getOrDefault(vrId.toLowerCase(Locale.ROOT),null);
+            if(versionRuleVO!=null){
+                versionRuleList.add(versionRuleVO);
+            }
+        });
+        return versionRuleList;
+    }
+
+    /**
+     * 鏌ヨ搴旂敤鑼冨洿
+     * @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;
+    }
+
+    /**
+     * 瀵煎嚭閫変腑鐨勭増鏈鍒�
+     * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+     * @param vrNames 闇�瑕佸鍑虹殑鐗堟湰瑙勫垯鍚嶇О
+     * @param flag 鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�
+     * @return
+     */
+    @Override
+    public String exportVersionRule(String exportFileName, String vrNames, boolean flag) throws PLException {
+        if(Func.isBlank(vrNames)){
+            throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勭増鏈鍒�!"});
+        }
+        //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+        exportFileName = Func.isBlank(exportFileName) ?  "鐗堟湰瑙勫垯瀵煎嚭_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+        //璁剧疆鍒楀悕
+        List<String> columns = this.getCloumns(flag);
+
+        //鍐檈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++) {
+            excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+        }
+        //鎸夌収鐗堟湰瑙勫垯鍚嶆煡璇紝鐒跺悗澶勭悊鐗堟湰瑙勫垯瀵煎嚭
+        List<String> vrIdList = Func.toStrList(vrNames);
+        List<OsRevisionRuleVO> revisionRuleVOList = this.getRevisionRuleByIds(vrIdList);
+        if(Func.isEmpty(revisionRuleVOList)){
+            excelDataList.add(new WriteExcelData(1,1, "鏍规嵁鍚嶇О鏈煡璇㈠埌鐗堟湰瑙勫垯淇℃伅锛岃鍒锋柊鍚庡皾璇曢噸鏂板鍑猴紒"));
+        }else{
+            for (int i = 0; i < revisionRuleVOList.size(); i++) {
+                OsRevisionRuleVO revisionRuleVO = revisionRuleVOList.get(i);
+                excelDataList.add(new WriteExcelData(i+1,0, revisionRuleVO.getId()));
+                excelDataList.add(new WriteExcelData(i+1,1, revisionRuleVO.getName()));
+                excelDataList.add(new WriteExcelData(i+1,2, revisionRuleVO.getJumpCharacter()));
+                excelDataList.add(new WriteExcelData(i+1,3, revisionRuleVO.getInitialValue()));
+                excelDataList.add(new WriteExcelData(i+1,4, revisionRuleVO.getStepLength()));
+                excelDataList.add(new WriteExcelData(i+1,5, revisionRuleVO.getPrefixion()));
+                excelDataList.add(new WriteExcelData(i+1,6, revisionRuleVO.getSuffix()));
+                excelDataList.add(new WriteExcelData(i+1,7, revisionRuleVO.getDescription()));
+                if(!flag){
+                    excelDataList.add(new WriteExcelData(i+1,8, Func.format(revisionRuleVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss")));
+                }
+            }
+        }
+        WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+        ExcelUtil.writeDataToFile(excelPath, excelOption);
+        return excelPath;
+    }
+
+    /**
+     * 涓嬭浇鐗堟湰瑙勫垯瀵煎叆妯℃澘
+     * @param exportFileName
+     * @return
+     * @throws PLException
+     */
+    @Override
+    public String downloadVersionRuleTemplate(String exportFileName) throws Exception {
+        //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+        exportFileName = Func.isBlank(exportFileName) ?  "鐗堟湰瑙勫垯瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+        //璁剧疆鍒楀悕
+        List<String> columns = this.getCloumns(true);
+        //璁剧疆蹇呭~鍒�
+        ColumnNameisRed.clear();
+        ColumnNameisRed.add(0);
+        ColumnNameisRed.add(3);
+        ColumnNameisRed.add(4);
+
+        //鍐檈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 importVersionRules(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<OsRevisionRulePO> poList = ExcelUtil.readDataObjectFromExcel(file, OsRevisionRulePO.class,excelOption,(value, po, fieldName)->{});
+            //鍘婚櫎閮芥槸绌虹殑鎯呭喌
+            if(CollectionUtils.isEmpty(poList)){
+                return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
+            }
+            //excel鍒ら噸锛屾暟鎹牎楠岋紝dto瀵硅薄杞崲锛屽瓨鍌ㄥ璞¤浆鎹紝鎵ц淇濆瓨
+            List<OsRevisionRuleDTO> dtoList = new ArrayList<>();
+            //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶇増鏈鍒欏悕锛寁alue锛氳鍙凤級
+            Map<String, String> excelReapeat = new HashMap<>();
+            //鏁版嵁搴撴煡璇㈡槸鍚︽湁宸插瓨鍦ㄧ殑鏋氫妇鍚嶏紝鏂逛究鍚庣画鍋氬垽閲嶅鐞�
+            List<OsRevisionRuleVO> versionRuleVOList = this.getRevisionRuleByIds(poList.stream().map(OsRevisionRulePO::getId).collect(Collectors.toSet()));
+            List<String> repeatVrId = new ArrayList<>();
+            if(Func.isNotEmpty(versionRuleVOList)){
+                repeatVrId = versionRuleVOList.stream().map(OsRevisionRuleVO::getId).collect(Collectors.toList());
+            }
+            //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌哄拰鍏朵粬鏍¢獙
+            List<String> finalRepeatVrId = repeatVrId;
+            poList.stream().forEach(vrPO -> {
+                if(Func.isBlank(vrPO.getId())){//鐗堟湰瑙勫垯鍚嶅垽绌�
+                    throw new VciBaseException("绗��"+vrPO.getRowIndex()+"銆戣锛寁ersionrulenameerror");
+                }else if(excelReapeat.containsKey(vrPO.getId())){//鐗堟湰瑙勫垯鍚嶈〃鏍间腑鍒ら噸
+                    throw new VciBaseException("绗��"+excelReapeat.get(vrPO.getId())+"銆戣鍜岀銆�"+vrPO.getRowIndex()+"銆戣鏁版嵁锛屽悕绉伴噸澶�");
+                }else if (Func.isNotEmpty(finalRepeatVrId) && finalRepeatVrId.contains(vrPO.getId())){//鍒ゆ柇鍚嶇О鏄惁涓庣郴缁熶腑閲嶅
+                    throw new VciBaseException("绗��"+vrPO.getRowIndex()+"銆戣锛屽悕绉板湪绯荤粺涓凡缁忓瓨鍦�,璇蜂慨鏀�!");
+                }
+
+                //鐗堟湰瑙勫垯鍚峞xcel涓垽閲嶅鐞�
+                excelReapeat.put(vrPO.getId(),vrPO.getRowIndex());
+                OsRevisionRuleDTO revisionRuleDTO = new OsRevisionRuleDTO();
+                //revisionRuleDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
+                revisionRuleDTO.setId(vrPO.getId());
+                revisionRuleDTO.setName(vrPO.getName());
+                revisionRuleDTO.setJumpCharacter(vrPO.getJumpCharacter());
+                revisionRuleDTO.setInitialValue(vrPO.getInitialValue());
+                revisionRuleDTO.setStepLength(vrPO.getStepLength());
+                revisionRuleDTO.setPrefixion(vrPO.getPrefixion());
+                revisionRuleDTO.setSuffix(vrPO.getSuffix());
+                revisionRuleDTO.setDescription(vrPO.getDescription());
+                try {
+                    //妫�鏌ョ増鏈鍒欐槸鍚﹀悎瑙�
+                    checkVersionRule(revisionRuleDTO);
+                } catch (PLException e) {
+                    e.printStackTrace();
+                    throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
+                }
+                dtoList.add(revisionRuleDTO);
+            });
+            //鎵ц淇濆瓨鎿嶄綔
+            dtoList.stream().forEach(dto->{
+                try {
+                    boolean b = platformClientUtil.getVersionService().addVersionRule(dto2VersionRule(dto));
+                    if(!b){
+                        throw new VciBaseException("save and return false");
+                    }
+                } catch (PLException e) {
+                    e.printStackTrace();
+                    throw new VciBaseException("鎵ц淇濆瓨鏃跺嚭鐜伴敊璇紝閿欒鐗堟湰瑙勫垯瀵硅薄鍚嶄负锛氥��" + dto.getId() + "銆戯紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e));
+                }
+            });
+        }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("鏋氫妇瀵煎叆鎴愬姛锛�");
+    }
+
+    /**
+     * 鑾峰彇瀵煎嚭鎴栧鍏ユā鏉跨殑鍒楀悕
+     * @param flag 鏄惁鑾峰彇瀵煎叆妯℃澘鍒楀悕
+     * @return
+     */
+    private List<String> getCloumns(boolean flag){
+        if(flag){
+            return new ArrayList<>(
+                    Arrays.asList(
+                            "鍚嶇О", "鏍囩", "璺宠穬瀛楃锛堜互閫楀彿鍒嗛殧锛�",
+                            "鍒濆鍊�", "姝ラ暱", "鍓嶇紑", "鍚庣紑", "鎻忚堪"
+                    )
+            );
+        }
+        return new ArrayList<>(
+                Arrays.asList(
+                        "鍚嶇О", "鏍囩", "璺宠穬瀛楃", "鍒濆鍊�", "姝ラ暱",
+                        "鍓嶇紑", "鍚庣紑", "鎻忚堪", "鍒涘缓鏃堕棿"
+                )
+        );
+    }
+
+    /**
      * 娓呴櫎缂撳瓨
      */
     @Override
     public void clearCache() {
 
     }
+
 }

--
Gitblit v1.9.3