From 404ca5b447c5d20bdaf83faef88aea76f9db583c Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期五, 18 十月 2024 15:00:27 +0800
Subject: [PATCH] command

---
 pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/CommandCtrl.java             |    2 
 pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/CommandSv.java               |    2 
 pms-parent/pms-test/src/main/java/com/dy/pmsTest/config/WebListenerConfiguration.java |   50 +++++++++++++++++++++++++
 pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/QueryVo.java                 |    2 
 pms-parent/pms-test/src/main/java/com/dy/pmsTest/config/WebFilterConfiguration.java   |   41 ++++++++++++++++++++
 5 files changed, 94 insertions(+), 3 deletions(-)

diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/CommandCtrl.java b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/CommandCtrl.java
similarity index 98%
rename from pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/CommandCtrl.java
rename to pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/CommandCtrl.java
index 2dacdc0..6dc2aad 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/CommandCtrl.java
+++ b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/CommandCtrl.java
@@ -1,4 +1,4 @@
-package com.dy.pmsBase.command;
+package com.dy.pmsTest.command;
 
 import com.alibaba.fastjson2.JSON;
 import com.dy.common.aop.SsoPowerAop;
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/CommandSv.java b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/CommandSv.java
similarity index 98%
rename from pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/CommandSv.java
rename to pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/CommandSv.java
index b9edf69..3c076e2 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/CommandSv.java
+++ b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/CommandSv.java
@@ -1,4 +1,4 @@
-package com.dy.pmsBase.command;
+package com.dy.pmsTest.command;
 
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pmsGlobal.daoTst.TstCommandMapper;
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/QueryVo.java b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/QueryVo.java
similarity index 90%
rename from pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/QueryVo.java
rename to pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/QueryVo.java
index 13d2ff9..18b91d2 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/command/QueryVo.java
+++ b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/command/QueryVo.java
@@ -1,4 +1,4 @@
-package com.dy.pmsBase.command;
+package com.dy.pmsTest.command;
 
 import com.dy.common.webUtil.QueryConditionVo;
 import lombok.*;
diff --git a/pms-parent/pms-test/src/main/java/com/dy/pmsTest/config/WebFilterConfiguration.java b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/config/WebFilterConfiguration.java
new file mode 100644
index 0000000..f955616
--- /dev/null
+++ b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/config/WebFilterConfiguration.java
@@ -0,0 +1,41 @@
+package com.dy.pmsTest.config;
+
+import com.dy.common.webFilter.DevStageFilter;
+import com.dy.common.webFilter.UserTokenFilter;
+import jakarta.servlet.Filter;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class WebFilterConfiguration {
+
+    @Value("${pms.global.dev}")
+    public String isDevStage ;//鏄惁涓哄紑鍙戦樁娈�
+
+    /**
+     * 鍚姩椤哄簭
+     */
+    private static final int order_UserTokenFilter = 1 ;
+    private static final int order_DevStageFilter = 100 ;
+
+
+    @Bean
+    public FilterRegistrationBean<? extends Filter> regFilter() {
+        FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>();
+        if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){
+            filterRegistrationBean.setFilter(new DevStageFilter());
+            filterRegistrationBean.addUrlPatterns("/*");//閰嶇疆杩囨护瑙勫垯
+            filterRegistrationBean.setName("devStageFilter");//璁剧疆杩囨护鍣ㄥ悕绉�
+            filterRegistrationBean.setOrder(order_DevStageFilter);//鎵ц娆″簭
+        }else{
+            filterRegistrationBean.setFilter(new UserTokenFilter());
+            filterRegistrationBean.addUrlPatterns("/*");//閰嶇疆杩囨护瑙勫垯
+            filterRegistrationBean.setName("UserTokenFilter");//璁剧疆杩囨护鍣ㄥ悕绉�
+            filterRegistrationBean.setOrder(order_UserTokenFilter);//鎵ц娆″簭
+        }
+        return filterRegistrationBean;
+    }
+
+}
diff --git a/pms-parent/pms-test/src/main/java/com/dy/pmsTest/config/WebListenerConfiguration.java b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/config/WebListenerConfiguration.java
new file mode 100644
index 0000000..b063b2a
--- /dev/null
+++ b/pms-parent/pms-test/src/main/java/com/dy/pmsTest/config/WebListenerConfiguration.java
@@ -0,0 +1,50 @@
+package com.dy.pmsTest.config;
+
+import com.dy.common.webListener.GenerateIdSetSuffixListener;
+import jakarta.servlet.ServletContextListener;
+import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class WebListenerConfiguration {
+
+    /**
+     * 鍚姩椤哄簭
+     */
+    //private static final int order_config = 0 ;
+    private static final int order_idSetSuffix = 1 ;
+
+    /*
+    * 瑙f瀽鍚勭***config.xml閰嶇疆鐨凜onfigListener锛屽綋鍓峴pringboot宸ョ▼鏆傛椂涓嶉噰鐢ㄦ绉嶉厤缃柟寮�
+    *
+    @Bean
+    public ConfigListener getGlConfigListener(){
+        return new ConfigListener() ;
+    }
+    /**
+     * 澶栭儴鎻愪緵Listener
+     * @param listener 澶栭儴鎻愪緵Listener
+     * @return 娉ㄥ唽Bean
+    @Bean
+    public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) {
+        ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
+        listenerRegistrationBean.setListener(listener);
+        listenerRegistrationBean.setOrder(order_config);
+        return listenerRegistrationBean;
+    }
+    */
+
+    /**
+     * 鍐呴儴鎻愪緵listener锛岃listener鍦ㄧ郴缁熷惎鍔ㄦ椂锛屾牴鎹厤缃� 璁剧疆ID浜х敓鍣ㄧ殑鍚庣紑
+     * @return 娉ㄥ唽Bean
+     */
+    @Bean
+    public ServletListenerRegistrationBean<? extends ServletContextListener> regIdSuffixListener() {
+        ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>();
+        listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener());
+        listenerRegistrationBean.setOrder(order_idSetSuffix);
+        return listenerRegistrationBean;
+    }
+
+}

--
Gitblit v1.8.0