From 79120a1740872fbb20a79d0cde0a3fa9f55ec285 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 31 七月 2024 17:29:12 +0800
Subject: [PATCH] 版本规则新增、修改接口上传。

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java |   46 ++++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
index 033c3f4..13dfada 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
@@ -280,17 +280,19 @@
     public boolean addSave(OsStatusDTO statusDTO) throws Exception {
         VciBaseUtil.alertNotNull(
             statusDTO,"鐘舵�佺殑淇℃伅",
-            statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О",
-            statusDTO.getName(),"鐘舵�佺殑涓枃鍚嶇О"
+            statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О"
         );
-        StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId());
-        if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) {
-            throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉帮紒"});
+        if (statusDTO.getId().length()>50) {
+            throw new PLException("500",new String[]{"鐘舵�佽嫳鏂囧悕绉颁笉鑳借秴杩�50涓瓧绗︼紒"});
         }
         // 鐘舵�佹睜鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣�
         String regex = "[a-z A-Z]*";
-        if ((!statusDTO.getId().matches(regex))) {
+        if (!statusDTO.getId().matches(regex)) {
             throw new PLException("500",new String[]{"鍚嶇О鍙兘涓鸿嫳鏂囷紒"});
+        }
+        StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId());
+        if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) {
+            throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉帮紒"});
         }
         //铏界劧浼氳嚜鍔ㄧ敓鎴恛id锛屼絾鏄繖鍎胯缃富閿紝閬垮厤鏀惧叆缂撳瓨鐨勬暟鎹槸娌℃湁oid鐨�
         statusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
@@ -351,21 +353,21 @@
         for(OsStatusDTO statusDTO : osStatusDTOS){
             //oid鍜宼s鍒ょ┖
             String oid = statusDTO.getOid();
-            //name涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄�
-            String name = statusDTO.getName();
+            //id涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄�
+            String id = statusDTO.getId();
             //鍚庡彴浼氱敤ts杩涜鏁版嵁涓�鑷存�ф牎楠�
             Date ts = statusDTO.getTs();
-            if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
+            if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){
                 throw new PLException("500",new String[]{"寰呭垹闄ょ殑鐘舵�佸垪琛ㄤ腑涓婚敭銆恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佺姸鎬佸悕绉般�恘ame銆戜笉鑳戒负绌猴紒"});
             }
             StatePool statePool = new StatePool();
             statePool.oid = oid;
-            statePool.name = name;
+            statePool.name = id;
             statePool.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat);
             statePoolList.add(statePool);
             boolean res = platformClientUtil.getStatePoolService().deleteStatePool(statePool);
             if(!res){
-                throw new PLException("500",new String[]{"鍒犻櫎鐘舵�佸悕绉颁负銆�" + name + "銆戠殑鏁版嵁鏃跺嚭鐜伴敊璇�!"});
+                throw new PLException("500",new String[]{"鍒犻櫎鐘舵�佸悕绉颁负銆�" + id + "銆戠殑鏁版嵁鏃跺嚭鐜伴敊璇�!"});
             }
         }
         //clearCache();
@@ -404,14 +406,14 @@
      * @return
      */
     @Override
-    public String exportStatus(String exportFileName, String statusOids) throws PLException {
+    public String exportStatus(String exportFileName, String statusOids,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) throws PLException {
         if(Func.isBlank(statusOids)){
             throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勫睘鎬�!"});
         }
         //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
         exportFileName = Func.isBlank(exportFileName) ?  "鐘舵�佹睜鐘舵�佸鍑篲" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
         //璁剧疆鍒楀悕
-        List<String> columns = new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩", "鍥剧墖", "鎻忚堪"));
+        List<String> columns = this.getCloumns(flag);
 
         //鍐檈xcel
         String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName +  ".xls";
@@ -453,9 +455,7 @@
         //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
         exportFileName = Func.isBlank(exportFileName) ?  "鐘舵�佹睜瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
         //璁剧疆鍒楀悕
-        List<String> columns = new ArrayList<>(
-                Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)","鍥剧墖(璺緞)", "鎻忚堪(鍙互涓虹┖)")
-        );
+        List<String> columns = this.getCloumns(true);
         //璁剧疆蹇呭~鍒�
         ColumnNameisRed.clear();
         ColumnNameisRed.add(0);
@@ -486,6 +486,20 @@
     }
 
     /**
+     * 鑾峰彇瀵煎嚭鎴栧鍏ユā鏉跨殑鍒楀悕
+     * @param flag 鏄惁鑾峰彇瀵煎叆妯℃澘鍒楀悕
+     * @return
+     */
+    private List<String> getCloumns(boolean flag){
+        if(flag){
+            return new ArrayList<>(
+                    Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)","鍥剧墖(璺緞)", "鎻忚堪(鍙互涓虹┖)")
+            );
+        }
+        return new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩", "鍥剧墖", "鎻忚堪"));
+    }
+
+    /**
      * 瀵煎叆鐘舵��
      * @param file
      * @return

--
Gitblit v1.9.3