generated from root/miduo_server
gm,权限,扶持功能优化
parent
e1aeb2246b
commit
62167de466
|
|
@ -27,7 +27,7 @@ public class LoginController {
|
||||||
@Resource
|
@Resource
|
||||||
private CUserDao cUserDao;
|
private CUserDao cUserDao;
|
||||||
|
|
||||||
private static final String ROOT = "root";
|
public static final String ROOT = "root";
|
||||||
|
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public String index(@SessionAttribute(WebSecurityConfig.SESSION_KEY)String account,Model model){
|
public String index(@SessionAttribute(WebSecurityConfig.SESSION_KEY)String account,Model model){
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.jmfy.controller;
|
||||||
import com.jmfy.WebSecurityConfig;
|
import com.jmfy.WebSecurityConfig;
|
||||||
import com.jmfy.dao.*;
|
import com.jmfy.dao.*;
|
||||||
import com.jmfy.model.*;
|
import com.jmfy.model.*;
|
||||||
|
import com.jmfy.model.vo.PowersEnum;
|
||||||
import com.jmfy.utils.*;
|
import com.jmfy.utils.*;
|
||||||
import config.SRechargeCommodityConfig;
|
import config.SRechargeCommodityConfig;
|
||||||
import org.apache.poi.ss.formula.functions.Odd;
|
import org.apache.poi.ss.formula.functions.Odd;
|
||||||
|
|
@ -25,6 +26,7 @@ import java.util.Map;
|
||||||
* 扶持功能,申请和审核
|
* 扶持功能,申请和审核
|
||||||
* @author hj
|
* @author hj
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
@Controller
|
@Controller
|
||||||
public class SupportController {
|
public class SupportController {
|
||||||
|
|
||||||
|
|
@ -86,15 +88,20 @@ public class SupportController {
|
||||||
@RequestMapping(value = "/sendRechargeGift",method = {RequestMethod.POST, RequestMethod.GET})
|
@RequestMapping(value = "/sendRechargeGift",method = {RequestMethod.POST, RequestMethod.GET})
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
int sendRechargeGift(@RequestBody SupportOrder order, HttpSession session) throws Exception {
|
int sendRechargeGift(@RequestBody SupportOrder order, HttpSession session) throws Exception {
|
||||||
String useName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
|
String userName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
|
||||||
if(null!= useName){
|
if(null != userName){
|
||||||
// 申请人
|
// 申请人
|
||||||
order.setProposer(useName);
|
order.setProposer(userName);
|
||||||
}
|
}
|
||||||
SupportUser supportUser = supportUserDao.getSupportUser(order.getServerId(), order.getUserId(), order.getAccountId());
|
SupportUser supportUser = supportUserDao.getSupportUser(order.getServerId(), order.getUserId(), order.getAccountId());
|
||||||
if (supportUser == null){
|
if (supportUser == null){
|
||||||
// gs账号不存在
|
// gs账号不存在
|
||||||
return 3;
|
return 0;
|
||||||
|
}
|
||||||
|
CAdmin admin = cUserDao.findAdmin(userName);
|
||||||
|
if (!supportUser.getProposer().equals(userName) && !admin.getSubAccount().contains(userName)){
|
||||||
|
// 权限不足
|
||||||
|
return 2;
|
||||||
}
|
}
|
||||||
order.setUserName(supportUser.getUserName());
|
order.setUserName(supportUser.getUserName());
|
||||||
order.setId(seqUtils.getSequence("support_order_id"));
|
order.setId(seqUtils.getSequence("support_order_id"));
|
||||||
|
|
@ -131,11 +138,16 @@ public class SupportController {
|
||||||
// 订单存在验证
|
// 订单存在验证
|
||||||
SupportOrder order = supportOrderDao.getSupportOrder(Integer.valueOf(id));
|
SupportOrder order = supportOrderDao.getSupportOrder(Integer.valueOf(id));
|
||||||
// 审核人
|
// 审核人
|
||||||
String useName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
|
String userName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
|
||||||
// 状态
|
// 状态
|
||||||
int status = Integer.valueOf(parameterMap.get("status"));
|
int status = Integer.valueOf(parameterMap.get("status"));
|
||||||
|
|
||||||
return auditSupportOrder(order,useName,status);
|
// 权限查询
|
||||||
|
CAdmin admin = cUserDao.findAdmin(userName);
|
||||||
|
if (!admin.getPowers().contains(PowersEnum.PASS_SUPPORT_PERMISSIONS.getId()) && status == 1){
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
return auditSupportOrder(order,userName,status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -148,15 +160,16 @@ public class SupportController {
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
int batchUpdateSupportStatus(HttpSession session) throws Exception {
|
int batchUpdateSupportStatus(HttpSession session) throws Exception {
|
||||||
// 审核人
|
// 审核人
|
||||||
String useName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
|
String userName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
|
||||||
CAdmin admin = cUserDao.findAdmin(useName);
|
CAdmin admin = cUserDao.findAdmin(userName);
|
||||||
if (!admin.getPowers().contains(60)){
|
if (!admin.getPowers().contains(PowersEnum.PASS_SUPPORT_PERMISSIONS.getId())){
|
||||||
// 没有权限
|
// 没有权限
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
List<SupportOrder> orders = supportOrderDao.getSupportOrderListByProposer(useName);
|
List<SupportOrder> orders = supportOrderDao.getSupportOrderList();
|
||||||
|
orders.removeIf(v-> !v.getProposer().equals(userName) && !admin.getSubAccount().contains(v.getProposer()));
|
||||||
for (SupportOrder order : orders) {
|
for (SupportOrder order : orders) {
|
||||||
int result = auditSupportOrder(order, useName, 1);
|
int result = auditSupportOrder(order, userName, 1);
|
||||||
// 有订单失败,直接返回
|
// 有订单失败,直接返回
|
||||||
if (result != SUCCEED){
|
if (result != SUCCEED){
|
||||||
return result ;
|
return result ;
|
||||||
|
|
@ -171,8 +184,17 @@ public class SupportController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/auditSupport",method = {RequestMethod.POST, RequestMethod.GET})
|
@RequestMapping(value = "/auditSupport",method = {RequestMethod.POST, RequestMethod.GET})
|
||||||
public String auditSupport(ModelMap map) throws Exception {
|
public String auditSupport(ModelMap map,HttpSession session) throws Exception {
|
||||||
|
// 获取当前操作着
|
||||||
|
String username = (String) session.getAttribute("username");
|
||||||
|
// 全部审核列表
|
||||||
List<SupportOrder> orderList = supportOrderDao.getSupportOrderList();
|
List<SupportOrder> orderList = supportOrderDao.getSupportOrderList();
|
||||||
|
// root账号可以查看全部,其他账号只能查看其自己和子账号
|
||||||
|
if (!username.equals(LoginController.ROOT)){
|
||||||
|
CAdmin admin = cUserDao.findAdmin(username);
|
||||||
|
// 非当前账号和非子账号得删除
|
||||||
|
orderList.removeIf(v-> !v.getProposer().equals(username) && !admin.getSubAccount().contains(v.getProposer()));
|
||||||
|
}
|
||||||
map.addAttribute("orderList",orderList);
|
map.addAttribute("orderList",orderList);
|
||||||
return "auditSupport";
|
return "auditSupport";
|
||||||
}
|
}
|
||||||
|
|
@ -184,9 +206,17 @@ public class SupportController {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/supportPlanList",method = {RequestMethod.POST, RequestMethod.GET})
|
@RequestMapping(value = "/supportPlanList",method = {RequestMethod.POST, RequestMethod.GET})
|
||||||
public String supportPlanList(ModelMap map) throws Exception {
|
public String supportPlanList(ModelMap map,HttpSession session) throws Exception {
|
||||||
// 服务器列表
|
// 获取当前操作着
|
||||||
|
String username = (String) session.getAttribute("username");
|
||||||
|
// 全部审核列表
|
||||||
List<SupportOrder> orderList = supportOrderDao.getSupportOrderList();
|
List<SupportOrder> orderList = supportOrderDao.getSupportOrderList();
|
||||||
|
// root账号可以查看全部,其他账号只能查看其自己和子账号
|
||||||
|
if (!username.equals(LoginController.ROOT)){
|
||||||
|
CAdmin admin = cUserDao.findAdmin(username);
|
||||||
|
// 非当前账号和非子账号得删除
|
||||||
|
orderList.removeIf(v-> !v.getProposer().equals(username) && !admin.getSubAccount().contains(v.getProposer()));
|
||||||
|
}
|
||||||
map.addAttribute("orderList",orderList);
|
map.addAttribute("orderList",orderList);
|
||||||
return "supportPlanList";
|
return "supportPlanList";
|
||||||
}
|
}
|
||||||
|
|
@ -215,6 +245,7 @@ public class SupportController {
|
||||||
* @param order
|
* @param order
|
||||||
* @param auditName
|
* @param auditName
|
||||||
* @param status
|
* @param status
|
||||||
|
* 0:已申请,1:已通过,2:已驳回
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
@ -223,11 +254,6 @@ public class SupportController {
|
||||||
if (order == null || order.getStatus() != 0){
|
if (order == null || order.getStatus() != 0){
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
// 权限查询
|
|
||||||
CAdmin admin = cUserDao.findAdmin(auditName);
|
|
||||||
if (!admin.getPowers().contains(60) && status == 1){
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
// 发送数据到游戏服
|
// 发送数据到游戏服
|
||||||
if (status == 1){
|
if (status == 1){
|
||||||
int result = sendGmSupport(order);
|
int result = sendGmSupport(order);
|
||||||
|
|
@ -275,9 +301,16 @@ public class SupportController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/gsAccountManage",method = {RequestMethod.POST, RequestMethod.GET})
|
@RequestMapping(value = "/gsAccountManage",method = {RequestMethod.POST, RequestMethod.GET})
|
||||||
public String gsAccountManage(ModelMap map) throws Exception {
|
public String gsAccountManage(ModelMap map,HttpSession session) throws Exception {
|
||||||
|
String username = (String)session.getAttribute("username");
|
||||||
// 获取用户列表
|
// 获取用户列表
|
||||||
List<SupportUser> userList = supportUserDao.getSupportUserList();
|
List<SupportUser> userList = supportUserDao.getSupportUserList();
|
||||||
|
// root账号可以查看全部,其他账号只能查看其自己和子账号
|
||||||
|
if (!username.equals(LoginController.ROOT)){
|
||||||
|
CAdmin admin = cUserDao.findAdmin(username);
|
||||||
|
// 非当前账号和非子账号得删除
|
||||||
|
userList.removeIf(v-> !v.getProposer().equals(username) && !admin.getSubAccount().contains(v.getProposer()));
|
||||||
|
}
|
||||||
//更新用户充值金额
|
//更新用户充值金额
|
||||||
updateUserRechargeMoney(userList);
|
updateUserRechargeMoney(userList);
|
||||||
map.addAttribute("userList",userList);
|
map.addAttribute("userList",userList);
|
||||||
|
|
@ -344,7 +377,7 @@ public class SupportController {
|
||||||
String useName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
|
String useName = (String) session.getAttribute(WebSecurityConfig.SESSION_KEY);
|
||||||
// 权限查询
|
// 权限查询
|
||||||
CAdmin admin = cUserDao.findAdmin(useName);
|
CAdmin admin = cUserDao.findAdmin(useName);
|
||||||
if (!admin.getPowers().contains(61)){
|
if (!admin.getPowers().contains(PowersEnum.DELETE_SUPPORT_ACCOUNT_PERMISSIONS.getId())){
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,10 +200,10 @@
|
||||||
layer.msg('申请扶持成功!', {icon: 6, time: 1000});
|
layer.msg('申请扶持成功!', {icon: 6, time: 1000});
|
||||||
}
|
}
|
||||||
if (data === 0) {
|
if (data === 0) {
|
||||||
layer.msg('申请扶持失败!', {icon: 6, time: 1000});
|
layer.msg('申请扶持失败 id错误,用户不存在', {icon: 6, time: 1000});
|
||||||
}
|
}
|
||||||
if (data === 3) {
|
if (data === 2) {
|
||||||
layer.msg('申请扶持失败 id错误,用户不存在', {icon: 6, time: 2000});
|
layer.msg('申请扶持失败 权限不足', {icon: 6, time: 2000});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data === 1) {
|
if (data === 1) {
|
||||||
layer.msg('操作成功!', {icon: 6, time: 1000});
|
layer.msg('操作成功!', {icon: 6, time: 1000});
|
||||||
|
window.location.reload();
|
||||||
}
|
}
|
||||||
if (data === 0) {
|
if (data === 0) {
|
||||||
layer.msg('操作失败', {icon: 6, time: 1000});
|
layer.msg('操作失败', {icon: 6, time: 1000});
|
||||||
|
|
@ -119,6 +120,7 @@
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data === 1) {
|
if (data === 1) {
|
||||||
layer.msg('操作成功!', {icon: 6, time: 1000});
|
layer.msg('操作成功!', {icon: 6, time: 1000});
|
||||||
|
window.location.reload();
|
||||||
}
|
}
|
||||||
if (data === 0) {
|
if (data === 0) {
|
||||||
layer.msg('操作失败', {icon: 6, time: 1000});
|
layer.msg('操作失败', {icon: 6, time: 1000});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue