generated from root/miduo_server
Merge branch 'jieling' of http://60.1.1.230/backend/gm_tw_admin into jieling
commit
589e9c2c6e
|
|
@ -391,6 +391,7 @@ public class OrderInfoController {
|
|||
}
|
||||
return "findOrder";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "toExporOrderPage",method = RequestMethod.GET)
|
||||
public String toExporOrderPage(ModelMap map){
|
||||
List<gameName> allGameName = null;
|
||||
|
|
@ -403,15 +404,11 @@ public class OrderInfoController {
|
|||
return "exporOrder";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static boolean isNumeric(String str) {
|
||||
try {
|
||||
new BigDecimal(str).toString();
|
||||
} catch (Exception e) {
|
||||
return false;//异常
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@ import com.jmfy.model.CServerOpenTime;
|
|||
import com.jmfy.model.ServerInfo;
|
||||
import com.jmfy.model.vo.ServerInfoVo;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.utils.Constants;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
import com.jmfy.utils.RedisUtil;
|
||||
import com.jmfy.utils.SeqUtils;
|
||||
import com.jmfy.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
|
@ -28,6 +27,8 @@ import java.util.List;
|
|||
|
||||
@Controller
|
||||
public class ServerInfoController {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ServerInfoController.class);
|
||||
|
||||
@Resource
|
||||
private ServerInfoDao serverInfoDao;
|
||||
|
||||
|
|
@ -68,9 +69,9 @@ public class ServerInfoController {
|
|||
}else if(serverInfo.getOpen_type()!=null&&serverInfo.getOpen_type().equals(Constants.SERVEROPEN_NUM)) {
|
||||
openT = "按量开服";
|
||||
}
|
||||
if(null!=openT)
|
||||
if(null!=openT) {
|
||||
serverInfoVo.setOpen_type(openT);
|
||||
|
||||
}
|
||||
}
|
||||
map.addAttribute("serverInfos", serverInfoVos);
|
||||
return "findServerInfo";
|
||||
|
|
@ -128,11 +129,10 @@ public class ServerInfoController {
|
|||
String register_state = request.getParameter("register_state");
|
||||
|
||||
ServerInfo info = serverInfoDao.getServerinfo(server_id);
|
||||
|
||||
// 未运营状态的服务器需要进行清库处理
|
||||
if (info != null && "-2".equals(info.getStatus())){
|
||||
int delUser = delUser(info);
|
||||
if (delUser != 0){
|
||||
return "404";
|
||||
}
|
||||
ThreadPoolManager.getInstance().execute(() -> delUser(info));
|
||||
}
|
||||
|
||||
serverInfoDao.updateServerInfo(server_id, status, 0, isnew, name,register_state);
|
||||
|
|
@ -252,36 +252,35 @@ public class ServerInfoController {
|
|||
* @param serverInfo
|
||||
* @return
|
||||
*/
|
||||
private int delUser(ServerInfo serverInfo){
|
||||
int wait = -1;
|
||||
private void delUser(ServerInfo serverInfo){
|
||||
String path = "/data/jieling/deluser.sh";
|
||||
|
||||
if (serverInfo.getIP() == null || "".equals(serverInfo.getIP())
|
||||
|| serverInfo.getServer_id() == null || "".equals(serverInfo.getServer_id())
|
||||
|| serverInfo.getCoreName() == null || "".equals(serverInfo.getCoreName())){
|
||||
System.err.printf("删除操作参数不全,执行失败:参数:%s",serverInfo.toString());
|
||||
return wait;
|
||||
LOGGER.error("删除操作参数不全,执行失败:参数:{}",serverInfo.toString());
|
||||
return;
|
||||
}
|
||||
String command = "sh " + path + " 210 " + serverInfo.getIP() + " " + serverInfo.getServer_id() + " " + serverInfo.getCoreName();
|
||||
List<String> processList = new ArrayList<>();
|
||||
|
||||
String command = "sh " + path + " 500 " + serverInfo.getIP() + " " + serverInfo.getServer_id() + " " + serverInfo.getCoreName();
|
||||
LOGGER.info("=================清库命令:{}",command);
|
||||
|
||||
Process exec = null;
|
||||
try {
|
||||
Process exec = Runtime.getRuntime().exec(command);
|
||||
BufferedReader input = new BufferedReader(new InputStreamReader(exec.getInputStream()));
|
||||
String line = "";
|
||||
while ((line = input.readLine()) != null) {
|
||||
processList.add(line);
|
||||
}
|
||||
System.out.printf("删除操作完成:命令:{%s}\n",command);
|
||||
wait = 0;
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
System.err.printf("删除操作失败:命令:{%s},报错:{%s}\n",command,e.getMessage());
|
||||
exec = Runtime.getRuntime().exec(command);
|
||||
|
||||
LOGGER.info("========================== 停服脚本执行结果开始 ===========================");
|
||||
new DealProcessSream(exec.getInputStream(),true).start();
|
||||
new DealProcessSream(exec.getErrorStream(),false).start();
|
||||
LOGGER.info("=========================== 停服脚本执行结果结束 ==========================");
|
||||
|
||||
exec.waitFor();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (exec != null) {
|
||||
exec.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("========================== 停服脚本执行结果开始 ===========================");
|
||||
processList.forEach(System.out::println);
|
||||
System.out.println("=========================== 停服脚本执行结果结束 ==========================");
|
||||
|
||||
return wait;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,9 +140,11 @@ public class GMHandler extends BaseHandler {
|
|||
jsonBan.put("dsid",zoneId);
|
||||
jsonBan.put("treat_type","7");
|
||||
jsonBan.put("banReason",content);
|
||||
LOGGER.info("message","ty,userId:{},zoneId:{},content:{},time:{}",userId,zoneId,content,time);
|
||||
CUserInfo coreUserInfo = userInfoDao.findUserInfoByUserId(Integer.valueOf(userId));
|
||||
if (coreUserInfo == null) {
|
||||
map.put("message","帐号不存在"+userId);
|
||||
LOGGER.error("message","天眼帐号不存在userId:{}",userId);
|
||||
throw new Exception("帐号不存在");
|
||||
} else {
|
||||
ServerInfo coreServerList = serverListDao.getServerinfo(String.valueOf(coreUserInfo.getServerid()));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package com.jmfy.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/24 11:55
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class DealProcessSream extends Thread {
|
||||
private InputStream inputStream;
|
||||
|
||||
private boolean judge;
|
||||
|
||||
public DealProcessSream(InputStream inputStream, boolean judge) {
|
||||
this.inputStream = inputStream;
|
||||
this.judge = judge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
InputStreamReader inputStreamReader = null;
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
inputStreamReader = new InputStreamReader(
|
||||
inputStream);
|
||||
br = new BufferedReader(inputStreamReader);
|
||||
// 打印信息
|
||||
String line = null;
|
||||
if (judge){
|
||||
while ((line = br.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (br.readLine() != null);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
if (br != null){
|
||||
br.close();
|
||||
}
|
||||
if (inputStreamReader != null){
|
||||
inputStreamReader.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.jmfy.utils;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/6/24 14:23
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ThreadPoolManager {
|
||||
|
||||
private static ThreadPoolExecutor executor;
|
||||
|
||||
public static ThreadPoolExecutor getInstance() {
|
||||
if (executor == null) {
|
||||
synchronized (ThreadPoolManager.class) {
|
||||
if (executor == null) {
|
||||
executor = executorService();
|
||||
}
|
||||
}
|
||||
}
|
||||
return executor;
|
||||
}
|
||||
|
||||
private static ThreadPoolExecutor executorService(){
|
||||
return new ThreadPoolExecutor(1,//池中保持线程数
|
||||
5,//最大线程数
|
||||
10,//当线程数大于核心时,终止前多余空闲线程等待时间
|
||||
TimeUnit.SECONDS,//时间单位为秒
|
||||
new LinkedBlockingDeque<>(10),//池内队列最高10个线程
|
||||
Executors.defaultThreadFactory(),//执行程序创建新线程使用默认工厂
|
||||
new ThreadPoolExecutor.DiscardPolicy());//出现阻塞时使用处理程序
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue