From 3e77538aa01616597bfe52a60d7b256011be9b6e Mon Sep 17 00:00:00 2001
From: chenjiantian <214228265@qq.com>
Date: 星期四, 02 十二月 2021 16:03:36 +0800
Subject: [PATCH] 基础功能完善
---
ximon-admin/src/main/java/com/sandu/ximon/admin/context/CustomerInspectContextHolder.java | 62 ++++++++++----------
ximon-admin/pom.xml | 18 ++++++
ximon-admin/src/main/java/com/sandu/ximon/admin/filter/CustomerInspectContextHolderFilter.java | 42 +++++++-------
pom.xml | 23 +++++++
ximon-admin/src/main/java/com/sandu/ximon/admin/security/SecurityUtils.java | 10 +-
5 files changed, 98 insertions(+), 57 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6096c87..c66be61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,6 +73,29 @@
<artifactId>weixin-java-miniapp</artifactId>
<version>${weixin-java.version}</version>
</dependency>
+
+ <!-- amqp 1.0 qpid client -->
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-jms-client</artifactId>
+ <version>0.57.0</version>
+ </dependency>
+ <!-- util for base64-->
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>com.aliyun</groupId>
+ <artifactId>aliyun-java-sdk-core</artifactId>
+ <version>4.5.6</version>
+ </dependency>
+ <dependency>
+ <groupId>com.aliyun</groupId>
+ <artifactId>aliyun-java-sdk-iot</artifactId>
+ <version>7.29.0</version>
+ </dependency>
</dependencies>
</dependencyManagement>
diff --git a/ximon-admin/pom.xml b/ximon-admin/pom.xml
index 8243414..dd2e6e8 100644
--- a/ximon-admin/pom.xml
+++ b/ximon-admin/pom.xml
@@ -23,6 +23,24 @@
<groupId>com.sandu.ximon</groupId>
<artifactId>sandu-common</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.qpid</groupId>
+ <artifactId>qpid-jms-client</artifactId>
+ </dependency>
+ <!-- util for base64-->
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.aliyun</groupId>
+ <artifactId>aliyun-java-sdk-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.aliyun</groupId>
+ <artifactId>aliyun-java-sdk-iot</artifactId>
+ </dependency>
</dependencies>
<!-- Maven鎺у埗Spring Profile -->
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/context/CustomerInspectContextHolder.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/context/CustomerInspectContextHolder.java
index 2da86f0..a9144aa 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/context/CustomerInspectContextHolder.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/context/CustomerInspectContextHolder.java
@@ -12,35 +12,35 @@
public class CustomerInspectContextHolder {
/**
- * 鏀寔鐖跺瓙绾跨▼涔嬮棿鐨勬暟鎹紶閫�
- */
- private final ThreadLocal<String> THREAD_LOCAL_TENANT = new ThreadLocal<>();
-
- /**
- * TTL 璁剧疆瀹㈡埛ID<br/>
- *
- */
- public void setCustomerId(String tenantId) {
- THREAD_LOCAL_TENANT.set(tenantId);
- }
-
- /**
- * 鑾峰彇TTL涓殑瀹㈡埛ID
- *
- * @return String
- */
- public Long getCustomerId() {
- String s = THREAD_LOCAL_TENANT.get();
- if(StrUtil.isNotBlank(s)){
- return Long.parseLong(s);
- }
- return null;
- }
-
- /**
- * 娓呴櫎Id
- */
- public void clear() {
- THREAD_LOCAL_TENANT.remove();
- }
+// * 鏀寔鐖跺瓙绾跨▼涔嬮棿鐨勬暟鎹紶閫�
+// */
+// private final ThreadLocal<String> THREAD_LOCAL_TENANT = new ThreadLocal<>();
+//
+// /**
+// * TTL 璁剧疆瀹㈡埛ID<br/>
+// *
+// */
+// public void setCustomerId(String tenantId) {
+// THREAD_LOCAL_TENANT.set(tenantId);
+// }
+//
+// /**
+// * 鑾峰彇TTL涓殑瀹㈡埛ID
+// *
+// * @return String
+// */
+// public Long getCustomerId() {
+// String s = THREAD_LOCAL_TENANT.get();
+// if(StrUtil.isNotBlank(s)){
+// return Long.parseLong(s);
+// }
+// return null;
+// }
+//
+// /**
+// * 娓呴櫎Id
+// */
+// public void clear() {
+// THREAD_LOCAL_TENANT.remove();
+// }
}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/filter/CustomerInspectContextHolderFilter.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/filter/CustomerInspectContextHolderFilter.java
index 1821a42..ba1c27b 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/filter/CustomerInspectContextHolderFilter.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/filter/CustomerInspectContextHolderFilter.java
@@ -21,24 +21,24 @@
* 绠$悊鍛樿瀹㈣繃婊�
* @author chenjiantian
*/
-@Slf4j
-@Component
-@Order(Ordered.HIGHEST_PRECEDENCE)
-public class CustomerInspectContextHolderFilter extends GenericFilterBean {
- @Override
- @SneakyThrows
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
- HttpServletRequest request = (HttpServletRequest) servletRequest;
- HttpServletResponse response = (HttpServletResponse) servletResponse;
- try {
- String customer = request.getHeader("customer");
-
- if (StringUtil.isNotBlank(customer)) {
- CustomerInspectContextHolder.setCustomerId(customer);
- }
- filterChain.doFilter(request, response);
- } finally {
- CustomerInspectContextHolder.clear();
- }
- }
-}
+//@Slf4j
+//@Component
+//@Order(Ordered.HIGHEST_PRECEDENCE)
+//public class CustomerInspectContextHolderFilter extends GenericFilterBean {
+// @Override
+// @SneakyThrows
+// public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+// HttpServletRequest request = (HttpServletRequest) servletRequest;
+// HttpServletResponse response = (HttpServletResponse) servletResponse;
+// try {
+// String customer = request.getHeader("customer");
+//
+// if (StringUtil.isNotBlank(customer)) {
+// CustomerInspectContextHolder.setCustomerId(customer);
+// }
+// filterChain.doFilter(request, response);
+// } finally {
+// CustomerInspectContextHolder.clear();
+// }
+// }
+//}
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/security/SecurityUtils.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/security/SecurityUtils.java
index 50a14ce..7951bc7 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/security/SecurityUtils.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/security/SecurityUtils.java
@@ -32,7 +32,7 @@
public class SecurityUtils {
/**
- * 鑾峰彇鐢ㄦ埛淇℃伅
+ * 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅
*/
private static UserDetails getUserDetails() {
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
@@ -54,9 +54,9 @@
}
/**
- * 鑾峰彇绯荤粺鐢ㄦ埛鍚嶇О 鐧诲綍鍚�
+ * 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛鐧诲綍鍚�
*
- * @return 绯荤粺鐢ㄦ埛鍚嶇О
+ * @return 褰撳墠鐧诲綍鐢ㄦ埛鐧诲綍鍚�
*/
public static String getUsername() {
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
@@ -81,9 +81,9 @@
}
/**
- * 鑾峰彇绯荤粺鐢ㄦ埛id
+ * 鑾峰彇褰撳墠鐧诲綍璐﹀彿鐨刬d
*
- * @return 绯荤粺鐢ㄦ埛id
+ * @return 褰撳墠鐧诲綍璐﹀彿鐨刬d
*/
public static Long getUserId() {
SecurityProperties properties = SpringContextHolder.getBean(SecurityProperties.class);
--
Gitblit v1.9.3