From b197c99ca21631c49b79dee5589e05743e7de73b Mon Sep 17 00:00:00 2001 From: xuexinpeng Date: Tue, 19 Dec 2023 16:35:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=89=E4=B8=8B=E5=88=97=E8=A1=A8=E5=8F=AA?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=BB=E6=9C=8D=E5=92=8C=E6=9C=AA=E5=90=88?= =?UTF-8?q?=E6=9C=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jmfy/controller/MailController.java | 4 +++- .../java/com/jmfy/controller/ServerInfoController.java | 4 +++- .../java/com/jmfy/controller/SupportController.java | 4 ++-- src/main/java/com/jmfy/dao/ServerInfoDao.java | 1 + src/main/java/com/jmfy/dao/impl/ServerInfoDaoImpl.java | 10 ++++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/jmfy/controller/MailController.java b/src/main/java/com/jmfy/controller/MailController.java index af10b3e..083e52a 100644 --- a/src/main/java/com/jmfy/controller/MailController.java +++ b/src/main/java/com/jmfy/controller/MailController.java @@ -67,7 +67,9 @@ public class MailController { public String toMailPage(ModelMap map,Integer type){ Map itemNameMap = FileCacheUtils.itemNameMap; try { - List allServerInfo = serverInfoDao.getAllServerInfo(); + //List allServerInfo = serverInfoDao.getAllServerInfo(); + //得到所有主服和未和服信息 + List allServerInfo = serverInfoDao.getServerInfoOfSlaveServer(0); map.addAttribute("serverInfos",allServerInfo); map.addAttribute("itemNameMap",itemNameMap); } catch (Exception e) { diff --git a/src/main/java/com/jmfy/controller/ServerInfoController.java b/src/main/java/com/jmfy/controller/ServerInfoController.java index c82763f..28a1df7 100644 --- a/src/main/java/com/jmfy/controller/ServerInfoController.java +++ b/src/main/java/com/jmfy/controller/ServerInfoController.java @@ -66,7 +66,9 @@ public class ServerInfoController { @RequestMapping(value = "/findServerInfo", method = {RequestMethod.POST, RequestMethod.GET}) public String findServerInfo(ModelMap map, int quick) throws Exception { List serverInfoVos = new ArrayList<>(); - List serverInfos = serverInfoDao.getAllServerInfo(); + //List serverInfos = serverInfoDao.getAllServerInfo(); + //查找所有主服和未合服信息 + List serverInfos = serverInfoDao.getServerInfoOfSlaveServer(0); for (ServerInfo serverInfo : serverInfos) { if (null == serverInfo.getServer_id()) { continue; diff --git a/src/main/java/com/jmfy/controller/SupportController.java b/src/main/java/com/jmfy/controller/SupportController.java index 8eb4771..ec6360d 100644 --- a/src/main/java/com/jmfy/controller/SupportController.java +++ b/src/main/java/com/jmfy/controller/SupportController.java @@ -63,8 +63,8 @@ public class SupportController { try { // 充值礼包列表 Map rechargeMap = FileCacheUtils.rechargeMap; - // 服务器列表 - List allServerInfo = serverInfoDao.getAllServerInfo(); + // 服务器列表 主服和未合服列表 + List allServerInfo = serverInfoDao.getServerInfoOfSlaveServer(0); map.addAttribute("serverInfo",allServerInfo); map.addAttribute("rechargeMap",rechargeMap); diff --git a/src/main/java/com/jmfy/dao/ServerInfoDao.java b/src/main/java/com/jmfy/dao/ServerInfoDao.java index 5865369..ed1fb36 100644 --- a/src/main/java/com/jmfy/dao/ServerInfoDao.java +++ b/src/main/java/com/jmfy/dao/ServerInfoDao.java @@ -11,6 +11,7 @@ import java.util.Map; public interface ServerInfoDao { List getAllServerInfo() throws Exception; List getServerInfoOfSubChannel(String subChannel) throws Exception; + List getServerInfoOfSlaveServer(int isSlaveServer) throws Exception; Map getAllServerMap() throws Exception; List getAllGameInfo() throws Exception; ServerInfo getServerInfo(String id) throws Exception; diff --git a/src/main/java/com/jmfy/dao/impl/ServerInfoDaoImpl.java b/src/main/java/com/jmfy/dao/impl/ServerInfoDaoImpl.java index 051b94c..6713139 100644 --- a/src/main/java/com/jmfy/dao/impl/ServerInfoDaoImpl.java +++ b/src/main/java/com/jmfy/dao/impl/ServerInfoDaoImpl.java @@ -43,6 +43,16 @@ public class ServerInfoDaoImpl implements ServerInfoDao { return serverInfos.stream().sorted().collect(Collectors.toList()); } + @Override + public List getServerInfoOfSlaveServer(int isSlaveServer) throws Exception{ + MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName); + Query query = new Query(Criteria.where("isSlave").is(isSlaveServer)); + List serverInfos = mongoTemplate.find(query, ServerInfo.class); + return serverInfos.stream().sorted().collect(Collectors.toList()); + + } + + @Override public Map getAllServerMap() throws Exception { List serverInfos = getAllServerInfo();