From 7b28553a4e944346c7931691253de5897a732bbd Mon Sep 17 00:00:00 2001
From: LiuY <1622779752@qq.com>
Date: Wed, 15 Mar 2023 17:01:00 +0800
Subject: [PATCH] =?UTF-8?q?1.=E7=99=BB=E5=BD=95=E7=9B=91=E5=90=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 6 +++
.../base/listener/login/AppLoginListener.java | 40 +++++++++++++++++
.../base/listener/login/WebLoginListener.java | 43 +++++++++++++++++++
3 files changed, 89 insertions(+)
create mode 100644 src/main/java/cn/com/tenlion/xzszwhy/base/listener/login/AppLoginListener.java
create mode 100644 src/main/java/cn/com/tenlion/xzszwhy/base/listener/login/WebLoginListener.java
diff --git a/pom.xml b/pom.xml
index 964e7f2..0c6ff4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,12 @@
1.0-SNAPSHOT
+
+ ink.wgink
+ basic-interface
+ 1.0-SNAPSHOT
+
+
ink.wgink
login-wechat
diff --git a/src/main/java/cn/com/tenlion/xzszwhy/base/listener/login/AppLoginListener.java b/src/main/java/cn/com/tenlion/xzszwhy/base/listener/login/AppLoginListener.java
new file mode 100644
index 0000000..ac67b88
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/xzszwhy/base/listener/login/AppLoginListener.java
@@ -0,0 +1,40 @@
+package cn.com.tenlion.xzszwhy.base.listener.login;
+
+import ink.wgink.exceptions.SearchException;
+import ink.wgink.interfaces.expand.login.ILoginAppHandlerService;
+import ink.wgink.pojo.bos.LoginAppUser;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * app登录监听
+ * @author : LY
+ * @date :2023-3-15 15:40
+ * @description :
+ * @modyified By:
+ */
+@Service
+public class AppLoginListener implements ILoginAppHandlerService {
+ /** 系统用户 */
+ private static final String sys_user_type = "1";
+ /** app标识 */
+ private static final String app_type_oa = "oa";
+ @Autowired
+ private HttpServletRequest httpServletRequest;
+
+ @Override
+ public void handle(LoginAppUser loginAppUser) throws Exception {
+ String appType = httpServletRequest.getHeader("APP-TYPE");
+ if(app_type_oa.equals(appType)){
+ if(!sys_user_type.equals(String.valueOf(loginAppUser.getUserType()))){
+ throw new SearchException("暂无权限登录");
+ }
+ }
+
+ }
+
+
+}
diff --git a/src/main/java/cn/com/tenlion/xzszwhy/base/listener/login/WebLoginListener.java b/src/main/java/cn/com/tenlion/xzszwhy/base/listener/login/WebLoginListener.java
new file mode 100644
index 0000000..821c3b5
--- /dev/null
+++ b/src/main/java/cn/com/tenlion/xzszwhy/base/listener/login/WebLoginListener.java
@@ -0,0 +1,43 @@
+package cn.com.tenlion.xzszwhy.base.listener.login;
+
+import ink.wgink.common.component.SecurityComponent;
+import ink.wgink.interfaces.expand.login.ILoginHandlerService;
+import ink.wgink.pojo.bos.LoginUser;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+
+/**
+ * web登录监听
+ * @author : LY
+ * @date :2023-3-13 17:53
+ * @description :
+ * @modyified By:
+ */
+@Service
+public class WebLoginListener implements ILoginHandlerService {
+
+ // 登录接口
+ private static final String web_url = "http://www.xzszwhy.cn/module/app/contentcensusrelease/log?requestUrl=网页USER";
+
+ @Override
+ public void handle(LoginUser loginUser) throws Exception {
+ // 请求登录统计接口
+ String url = web_url + loginUser.getUserId();
+ CloseableHttpClient client = HttpClientBuilder.create().build();
+ HttpGet get = new HttpGet(url);
+ try {
+ HttpResponse response = client.execute(get);
+ String res = EntityUtils.toString(response.getEntity());
+ System.out.println("==================请求登录接口==================" + res);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}