소스 검색

伊宁版本更新:
a.新增sse服务器代码逻辑:全局以会话id为key存储各自会话的通讯链接,心跳包以及登出指令都以当前会话id为基础单位发送指令
b.修改伊宁mainView首页,增加跳转参数clientId用以sse通讯
c.新增sse请求地址获取接口
d.增加weblog前端日志接口
e.更改伊宁逻辑,修改登录缓存逻辑

1037015548@qq.com 1 주 전
부모
커밋
5a1bf8537a

+ 13 - 14
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java

@@ -269,19 +269,18 @@ public class SysIndexController extends BaseController
             }
         }
         mmap.put("danganList",userRelates);
-        //TODO 伊宁专有逻辑
-        List<UserRelate> leftOneList = userRelates.stream().filter(x->"基础支撑系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
-        List<UserRelate> leftTwoList = userRelates.stream().filter(x->"智慧办公系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
-        List<UserRelate> leftThreeList = userRelates.stream().filter(x->"智慧客服系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
-        List<UserRelate> rightOneList = userRelates.stream().filter(x->"智慧生产系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
-        List<UserRelate> rightTwoList = userRelates.stream().filter(x->"智慧管网系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
-        List<UserRelate> rightThreeList = userRelates.stream().filter(x->"智慧营业系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
-        mmap.put("leftOneList",leftOneList);
-        mmap.put("leftTwoList",leftTwoList);
-        mmap.put("leftThreeList",leftThreeList);
-        mmap.put("rightOneList",rightOneList);
-        mmap.put("rightTwoList",rightTwoList);
-        mmap.put("rightThreeList",rightThreeList);
+//        List<UserRelate> leftOneList = userRelates.stream().filter(x->"基础支撑系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
+//        List<UserRelate> leftTwoList = userRelates.stream().filter(x->"智慧办公系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
+//        List<UserRelate> leftThreeList = userRelates.stream().filter(x->"智慧客服系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
+//        List<UserRelate> rightOneList = userRelates.stream().filter(x->"智慧生产系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
+//        List<UserRelate> rightTwoList = userRelates.stream().filter(x->"智慧管网系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
+//        List<UserRelate> rightThreeList = userRelates.stream().filter(x->"智慧营业系统".equals(x.getDangan().getMenuName())).collect(Collectors.toList());
+//        mmap.put("leftOneList",leftOneList);
+//        mmap.put("leftTwoList",leftTwoList);
+//        mmap.put("leftThreeList",leftThreeList);
+//        mmap.put("rightOneList",rightOneList);
+//        mmap.put("rightTwoList",rightTwoList);
+//        mmap.put("rightThreeList",rightThreeList);
 //        return "mainLhk";
 //        return "main";
         return "mainYining";
@@ -588,7 +587,7 @@ public class SysIndexController extends BaseController
 //        List<Dangan>  danganList = danganService.selectDanganList(new Dangan());
 
         mmap.put("sessionId",sessionId);
-
+        System.out.println("yining页面:"+sessionId);
         //23年2月14日新增,加入档案信息
         if(!CollectionUtils.isEmpty(userRelates)) {
             for (UserRelate relate : userRelates) {

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -104,6 +104,15 @@ public class SysLoginController extends BaseController
         }
     }
 
+    @PostMapping("/logout")
+    @ResponseBody
+    public AjaxResult logout() {
+        Subject subject = SecurityUtils.getSubject();
+        subject.logout(); // 调用Shiro的退出方法
+        
+        return success();
+    }
+
     @Autowired
     private ISysUserService userService;
 

+ 6 - 1
ruoyi-admin/src/main/resources/static/ruoyi/index.js

@@ -54,6 +54,7 @@ document.addEventListener('keypress', resetTimer, false);
 document.addEventListener('touchmove', resetTimer, false);
 document.addEventListener('',resetTimer,false);
 
+
 // var danganYiningList = [[${danganList}]];
 var quanjuChildWindow = [];
 function quitSystem() {
@@ -140,7 +141,10 @@ function quitSystem() {
                                 console.log("水力模型登出:" + error)
                             }
                         }else if ("客服中心" === userRelate[i].danganName) {
-                            window.open("https://scs.xjynwater.com/ucmweb/logout.action");
+                            // window.open("https://scs.xjynwater.com/ucmweb/logout.action");
+                            var win = window.open("https://scs.xjynwater.com/ucmweb/logout.html");
+                            console.log(000);
+                            setTimeout(function() { console.log(111);win.close(); }, 1000);
                         } else if (userRelate[i].danganUrl.indexOf("https://office.xjynwater.com")!==-1) {
                             //TODO 方格
                             try {
@@ -173,6 +177,7 @@ function quitSystem() {
         }
     });
     $.modal.loading("正在退出登录,请稍后...");
+    let thisWindow = window;
     setTimeout(function () {
         $.modal.closeLoading();
         window.open("/logout",'_self');

+ 1 - 0
ruoyi-admin/src/main/resources/templates/mainYiningView.html

@@ -195,6 +195,7 @@
     }, 4000);
 
 	var sessionId = [[${sessionId}]];
+	console.log("伊宁会话:"+sessionId);
 
 	function opennewpage(url) {
 

+ 16 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java

@@ -2,6 +2,10 @@ package com.ruoyi.framework.shiro.web.filter;
 
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.shiro.session.SessionException;
 import org.apache.shiro.subject.Subject;
 import org.slf4j.Logger;
@@ -65,6 +69,18 @@ public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter
             {
                 log.error("logout fail.", ise);
             }
+            //TODO 伊宁会话登出特殊处理
+            if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
+                HttpServletRequest httpRequest = (HttpServletRequest) request;
+                HttpServletResponse httpResponse = (HttpServletResponse) response;
+                String contextPath = httpRequest.getContextPath();
+                Cookie cookie = new Cookie("RUOYI_SHIRO_SESSION", null);
+                cookie.setPath(contextPath == null || contextPath.length() == 0 ? "/" : contextPath);
+                cookie.setMaxAge(0); // 立即删除
+                cookie.setHttpOnly(true);
+                // 如需支持https,建议加上 cookie.setSecure(true);
+                httpResponse.addCookie(cookie);
+            }
             issueRedirect(request, response, redirectUrl);
         }
         catch (Exception e)