generated from root/miduo_server
后端通知页面,小红点
parent
d05dfb2fc7
commit
e5237d8e08
|
|
@ -2,6 +2,7 @@ package com;
|
|||
|
||||
import com.jmfy.config.GlobalSysSettings;
|
||||
import com.jmfy.controller.GlobalSysController;
|
||||
import com.jmfy.controller.LoginController;
|
||||
import com.jmfy.handler.BaseHandler;
|
||||
import com.jmfy.handler.ManagerManager;
|
||||
import com.jmfy.thrift.pool.ThriftPoolUtils;
|
||||
|
|
@ -45,6 +46,7 @@ public class Application extends SpringBootServletInitializer {
|
|||
MinuteTask minuteTask = configurableApplicationContext.getBean(MinuteTask.class);
|
||||
minuteTask.setsHotFixManager(sHotFixManager);
|
||||
TaskKit.scheduleWithFixedDelay(minuteTask,30,60, TimeUnit.SECONDS);
|
||||
TaskKit.scheduleWithFixedDelay(LoginController::sessionHandler, 1000, 200, TimeUnit.MILLISECONDS);
|
||||
FileCacheUtils.initData();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jmfy.WebSecurityConfig;
|
||||
import com.jmfy.dao.CUserDao;
|
||||
import com.jmfy.dao.ChannelInfoDao;
|
||||
|
|
@ -10,6 +11,7 @@ import com.jmfy.model.vo.IdentityVo;
|
|||
import com.jmfy.model.vo.PowersEnum;
|
||||
import com.jmfy.model.vo.PowersVo;
|
||||
import com.jmfy.utils.DateUtil;
|
||||
import com.jmfy.utils.ExpiryMap;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
|
@ -20,6 +22,8 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -34,6 +38,65 @@ public class LoginController {
|
|||
|
||||
static final String ROOT = "root";
|
||||
|
||||
/**
|
||||
* id记录
|
||||
*/
|
||||
private static int sessionId = 0;
|
||||
/**
|
||||
* 消息map
|
||||
*/
|
||||
private static ExpiryMap<String,String> sessionMaps = new ExpiryMap<>();
|
||||
/**
|
||||
* 队列大小
|
||||
*/
|
||||
private static final int QUEUE_LENGTH = 10000*10;
|
||||
/**
|
||||
* 基于内存的阻塞队列
|
||||
*/
|
||||
private static BlockingQueue<String> queue = new LinkedBlockingQueue<>(QUEUE_LENGTH);
|
||||
|
||||
/**
|
||||
* 添加信息至队列中
|
||||
* @param content
|
||||
*/
|
||||
public static void addQueue(String content) {
|
||||
queue.offer(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息处理
|
||||
*/
|
||||
public static void sessionHandler(){
|
||||
String str = null;
|
||||
while ((str = queue.poll()) != null){
|
||||
sessionMaps.put(String.valueOf(sessionId),str,10*60*1000);
|
||||
sessionId++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消息
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/action", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody String action(){
|
||||
if (sessionMaps.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
return JSONObject.toJSONString(sessionMaps);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除消息
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/readAction", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int readAction(HttpServletRequest request){
|
||||
String id = request.getParameter("id");
|
||||
sessionMaps.remove(id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@GetMapping("/")
|
||||
public String index(){
|
||||
return "index";
|
||||
|
|
|
|||
|
|
@ -390,6 +390,7 @@ public class OrderInfoController {
|
|||
workbook.write(fOut);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LoginController.addQueue("订单列表《"+name+"》导出报错:"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
|
|
@ -407,6 +408,7 @@ public class OrderInfoController {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
LoginController.addQueue("订单列表《"+name+"》导出完成!");
|
||||
LOGGER.info("导出订单操作,excel文件写入耗时:{}毫秒",DateUtil.now()-start);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ public class ServerInfoController {
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LoginController.addQueue("服务器缓存刷新完成!");
|
||||
state = 0;
|
||||
}
|
||||
|
||||
|
|
@ -457,7 +458,7 @@ public class ServerInfoController {
|
|||
portStatusMap.clear();
|
||||
portStatusMap = cacheMap;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("监听脚本报错:::");
|
||||
LoginController.addQueue("检查游戏端口状态报错:"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (exec != null) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.jmfy.utils;
|
||||
|
||||
import com.jmfy.controller.LoginController;
|
||||
import com.jmfy.dao.ServerInfoDao;
|
||||
import com.jmfy.handler.DingTalkLogic;
|
||||
import com.jmfy.handler.GMHandler;
|
||||
|
|
@ -135,6 +136,7 @@ public class AutoServerManager {
|
|||
updateServer(oldServer, ServerStatusEnum.CROWDING.getId(), 0, serverId);
|
||||
// 新服务器状态更新
|
||||
updateServer(serverInfo, ServerStatusEnum.FLUENT.getId(), 1, serverInfo.getServer_id());
|
||||
LoginController.addQueue("自动开服,服务器:" + serverInfo.getServer_id() +"清库重启完毕");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,6 +195,7 @@ public class AutoServerManager {
|
|||
+ restart+"}";
|
||||
} while (i < 3);
|
||||
} catch (Exception e) {
|
||||
LoginController.addQueue("检查服务器开启状态报错,服务器:"+serverId+",报错:"+e.getMessage());
|
||||
cont = "服务器验证状态异常:{"+e.getMessage()+"}";
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -232,6 +235,7 @@ public class AutoServerManager {
|
|||
if (serverStatus){
|
||||
// 入库
|
||||
serverInfoDao.updateServerInfo(clone);
|
||||
LoginController.addQueue("手动开服,服务器:" + clone.getServer_id() +"清库重启完毕");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
<button type="submit" th:id="${obj.path}" class="btn btn-primary" onclick="return downloadFile(this)">
|
||||
<i class="Hui-iconfont"></i> 下载
|
||||
</button>
|
||||
<button type="button" th:id="${obj.path}" class="btn btn-primary" onclick="return deleteFile(this)">
|
||||
<button type="button" th:id="${obj.path}" class="btn btn-secondary" onclick="return deleteFile(this)">
|
||||
<i class="Hui-iconfont"></i> 删除
|
||||
</button>
|
||||
</th>
|
||||
|
|
|
|||
|
|
@ -28,12 +28,18 @@
|
|||
<body>
|
||||
<header class="navbar-wrapper">
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="container-fluid cl"><a class="logo navbar-logo f-l mr-10 hidden-xs">太初行管理平台</a> <a
|
||||
class="logo navbar-logo-m f-l mr-10 visible-xs">H-ui</a>
|
||||
<div class="container-fluid cl"><a class="logo navbar-logo f-l mr-10 hidden-xs">太初行管理平台</a>
|
||||
<a class="logo navbar-logo-m f-l mr-10 visible-xs">H-ui</a>
|
||||
<span class="logo navbar-slogan f-l mr-10 hidden-xs">v3.1</span>
|
||||
<a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:;"></a>
|
||||
<nav class="nav navbar-nav">
|
||||
<nav class="nav navbar-nav navbar-userbar hidden-xs">
|
||||
<ul class="cl">
|
||||
<li class="dropDown dropDown_hover">
|
||||
<a href="#" id="sessions" class="dropDown_A"
|
||||
style="color: green;background-color: #c6c6c6;font-weight: bolder;">0</a>
|
||||
<ul id="sessionul" class="dropDown-menu menu radius box-shadow">
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav id="Hui-userbar" class="nav navbar-nav navbar-userbar hidden-xs">
|
||||
|
|
@ -120,6 +126,70 @@
|
|||
<script type="text/javascript" src="lib/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var locals = [];
|
||||
|
||||
function conn(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {},
|
||||
url: "/action",
|
||||
success: function (data) {
|
||||
var aObj = document.getElementById("sessions");
|
||||
if (data !== "" && null != data){
|
||||
var list = JSON.parse(data);
|
||||
aObj.innerText = Object.keys(list).length;
|
||||
aObj.style.color = "red";
|
||||
// 消息体
|
||||
sessionShow(list);
|
||||
}else {
|
||||
aObj.innerText = 0;
|
||||
aObj.style.color = "green"
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
window.setInterval("conn()",1000);
|
||||
|
||||
/**
|
||||
* 展示信息
|
||||
* @param list
|
||||
*/
|
||||
function sessionShow(list) {
|
||||
if (list === "" || list == null){
|
||||
return;
|
||||
}
|
||||
// 获取本地存储的消息
|
||||
for (var key in list){
|
||||
if (locals == null || locals[key] == null){
|
||||
var value = list[key];
|
||||
// 创建li,设置内容和id
|
||||
var ele = document.createElement("li");
|
||||
ele.id = "li"+key;
|
||||
ele.innerHTML = "<a href='#' id='"+ key +"' style='color: darkred;' onclick='return readSessions(this)'>"+value+"</a>";
|
||||
// 添加到ul
|
||||
document.getElementById("sessionul").appendChild(ele);
|
||||
}
|
||||
}
|
||||
locals = list;
|
||||
}
|
||||
|
||||
function readSessions(obj) {
|
||||
var id = $(obj).attr("id");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"id": id
|
||||
},
|
||||
url: "/readAction",
|
||||
success: function () {
|
||||
$(('#li'+id)).html("");
|
||||
conn();
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -26,9 +26,19 @@
|
|||
<h1 class="f-20 text-success">太初行管理后台</h1>
|
||||
</div>
|
||||
<div style="margin-left: 20px;font-size: 18px">
|
||||
<div>
|
||||
<h2 style="color: red" class="f-18">更新日志[2021-12-03]</h2>
|
||||
<p class="f-14" style="line-height:32px;">
|
||||
1、页面添加小红字通知,位置页面左上角,“太初行管理平台”右侧,作用如下:<br>
|
||||
(1)部分会在后台执行的操作,会在操作完成后通过红字通知前台,显示完成的消息或者报错信息<br>
|
||||
(2)每一条红点信息保存10分钟,超过时间未读将会在缓存中消失,页面中会在刷新后消失<br>
|
||||
(3)每一条消息可点击,表示已读,已读的消息会删除<br>
|
||||
(4)目前已拥有的通知,订单下载完成,自动开服完成,清库完成和相关报错
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<h2 style="color: red" class="f-18">更新日志[2021-12-01]</h2>
|
||||
<p class="f-16" style="line-height:40px;">
|
||||
<p class="f-14" style="line-height:32px;">
|
||||
1、订单导出功能大改,解决下载订单需要在页面卡半天的问题,详细修改如下:<br>
|
||||
(1)订单列表的两个按钮改为:《订单查询和导出》 和 《订单下载列表》<br>
|
||||
《订单查询和导出》负责订单的查询和导出,导出需要输入文件名称,文件名称不能包含下划线"_"<br>
|
||||
|
|
@ -38,7 +48,7 @@
|
|||
</div>
|
||||
<div>
|
||||
<h2 style="color: red" class="f-18">更新日志[2021-11-11]</h2>
|
||||
<p class="f-16" style="line-height:40px;">
|
||||
<p class="f-14" style="line-height:32px;">
|
||||
1、天眼封禁优化<br>
|
||||
2、服务器列表优化,新增缓存刷新按钮<br>
|
||||
3、服务器信息修改功能优化<br>
|
||||
|
|
|
|||
Loading…
Reference in New Issue