generated from root/miduo_server
公会第二版 未完成
parent
0acd7a0b1b
commit
174784d119
|
|
@ -0,0 +1,82 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import com.jmfy.WebSecurityConfig;
|
||||
import com.jmfy.dao.CUserDao;
|
||||
import com.jmfy.dao.GsGuildDao;
|
||||
import com.jmfy.dao.ServerInfoDao;
|
||||
import com.jmfy.model.CAdmin;
|
||||
import com.jmfy.model.GsGuildInfoBean;
|
||||
import com.jmfy.model.ServerInfo;
|
||||
import com.jmfy.model.vo.PowersEnum;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/5/20 10:13
|
||||
* @Description: 公会
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class GuildController {
|
||||
|
||||
@Resource
|
||||
private GsGuildDao gsGuildDao;
|
||||
@Resource
|
||||
private ServerInfoDao serverInfoDao;
|
||||
@Resource
|
||||
private CUserDao cUserDao;
|
||||
|
||||
/***
|
||||
* 公会列表管理界面
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/guildListManager",method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String guildListManager(ModelMap map){
|
||||
try {
|
||||
ArrayList<GsGuildInfoBean> guildList = new ArrayList<>();
|
||||
|
||||
List<ServerInfo> serverInfo = serverInfoDao.getAllServerInfo();
|
||||
for (ServerInfo info : serverInfo) {
|
||||
List<GsGuildInfoBean> beans = gsGuildDao.getGuildList(Integer.parseInt(info.getServer_id()));
|
||||
guildList.addAll(beans);
|
||||
}
|
||||
map.addAttribute("guildList",guildList);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "guildListManager";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateGuildInfo",method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody
|
||||
int updateGuildInfo(HttpServletRequest request) throws Exception {
|
||||
String userName = (String) request.getSession().getAttribute(WebSecurityConfig.SESSION_KEY);
|
||||
// 权限查询
|
||||
CAdmin admin = cUserDao.findAdmin(userName);
|
||||
if (!admin.getPowers().contains(PowersEnum.GUILD_OPERATE_PERMISSIONS.getId())){
|
||||
return 3;
|
||||
}
|
||||
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
// 参数
|
||||
int guildId = Integer.valueOf(parameterMap.get("guildId"));
|
||||
int type = Integer.valueOf(parameterMap.get("type"));
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.jmfy.dao;
|
||||
|
||||
import com.jmfy.model.GsGuildInfoBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/5/20 10:32
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface GsGuildDao {
|
||||
|
||||
/**
|
||||
* 获取公会列表
|
||||
* @return
|
||||
* @param serverId
|
||||
* @throws Exception
|
||||
*/
|
||||
List<GsGuildInfoBean> getGuildList(int serverId) throws Exception;
|
||||
|
||||
/**
|
||||
* 查找单个公会
|
||||
* @param serverId
|
||||
* @param guildId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
GsGuildInfoBean findGuildInfo(int serverId, int guildId) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改公会信息
|
||||
* @param serverId
|
||||
* @param guildInfoBean
|
||||
* @throws Exception
|
||||
*/
|
||||
void updateGuildInfo(int serverId, GsGuildInfoBean guildInfoBean) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.jmfy.dao.impl;
|
||||
|
||||
import com.jmfy.dao.GsGuildDao;
|
||||
import com.jmfy.model.GsGuildInfoBean;
|
||||
import com.jmfy.utils.Connect;
|
||||
import com.jmfy.utils.MongoName;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/5/20 10:48
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class GsGuildDaoImpl implements GsGuildDao {
|
||||
|
||||
@Resource
|
||||
private Connect connect;
|
||||
|
||||
@Override
|
||||
public List<GsGuildInfoBean> getGuildList(int serverId) throws Exception {
|
||||
String dbName = MongoName.getMongoDBName(serverId);
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query();
|
||||
return mongoTemplate.find(query, GsGuildInfoBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GsGuildInfoBean findGuildInfo(int serverId, int guildId) throws Exception {
|
||||
String dbName = MongoName.getMongoDBName(serverId);
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query(Criteria.where("_id").is(guildId));
|
||||
return mongoTemplate.findOne(query, GsGuildInfoBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGuildInfo(int serverId, GsGuildInfoBean guildInfoBean) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ package com.jmfy.model;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
public class GsGuilidManagerBean {
|
||||
public class GsGuildManagerBean {
|
||||
|
||||
public static Map<Integer,GsGuildInfoBean> guildInfoMap = new HashMap<>();
|
||||
public static Map<String,GsGuildInfoBean> guildNameInfoMap = new HashMap<>();
|
||||
|
|
@ -13,7 +13,7 @@ public class GsGuilidManagerBean {
|
|||
}
|
||||
|
||||
public static void setGuildInfoMap(Map<Integer, GsGuildInfoBean> guildInfoMap) {
|
||||
GsGuilidManagerBean.guildInfoMap = guildInfoMap;
|
||||
GsGuildManagerBean.guildInfoMap = guildInfoMap;
|
||||
}
|
||||
|
||||
public static Map<String, GsGuildInfoBean> getGuildNameInfoMap() {
|
||||
|
|
@ -21,7 +21,7 @@ public class GsGuilidManagerBean {
|
|||
}
|
||||
|
||||
public static void setGuildNameInfoMap(Map<String, GsGuildInfoBean> guildNameInfoMap) {
|
||||
GsGuilidManagerBean.guildNameInfoMap = guildNameInfoMap;
|
||||
GsGuildManagerBean.guildNameInfoMap = guildNameInfoMap;
|
||||
}
|
||||
|
||||
public static Map<Integer, List<GsGuildLogBean>> getGuildLogInfoMap() {
|
||||
|
|
@ -29,6 +29,6 @@ public class GsGuilidManagerBean {
|
|||
}
|
||||
|
||||
public static void setGuildLogInfoMap(Map<Integer, List<GsGuildLogBean>> guildLogInfoMap) {
|
||||
GsGuilidManagerBean.guildLogInfoMap = guildLogInfoMap;
|
||||
GsGuildManagerBean.guildLogInfoMap = guildLogInfoMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,8 @@ public enum PowersEnum {
|
|||
PACKAGE_NAME_MANAGER(410,"频道管理",400),
|
||||
ADD_PACKAGE_NAME(411,"权限: 添加频道",400),
|
||||
DELETE_PACKAGE_NAME(412,"权限: 删除频道",400),
|
||||
GUILD_LIST_MANAGER(413,"公会列表管理",400),
|
||||
GUILD_OPERATE_PERMISSIONS(414,"权限: 操作公会",400),
|
||||
|
||||
// 流水日志管理500-599
|
||||
BILL_LOG(500,"流水日志管理",500),
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@
|
|||
href="javascript:;">添加白名单账号英雄</a></li>
|
||||
<li th:if="${#lists.contains(pos.powers,410)} "><a data-href="packageInfoList" data-title="频道管理"
|
||||
href="javascript:;">频道管理</a></li>
|
||||
<li th:if="${#lists.contains(pos.powers,413)} "><a data-href="packageInfoList" data-title="公会列表管理"
|
||||
href="javascript:;">公会列表管理</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
|||
Loading…
Reference in New Issue