|  |  | @ -30,7 +30,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean runShell(String shell) { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行shell命令..."); | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> shell命令..."); | 
			
		
	
		
			
				
					|  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |             new WinCommandUtil(shell).run(); | 
			
		
	
		
			
				
					|  |  |  |         }catch (Exception e){ | 
			
		
	
	
		
			
				
					|  |  | @ -42,7 +42,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean runBak(String path) { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行备份命令..."); | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 备份命令..."); | 
			
		
	
		
			
				
					|  |  |  |         boolean retBool; | 
			
		
	
		
			
				
					|  |  |  |         log.info("创建备份文件目录..."); | 
			
		
	
		
			
				
					|  |  |  |         String format = DateTimeFormatter.BASIC_ISO_DATE.format(LocalDate.now()); | 
			
		
	
	
		
			
				
					|  |  | @ -103,6 +103,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean runRestore(String filePath) { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 还原命令..."); | 
			
		
	
		
			
				
					|  |  |  |         boolean retBool; | 
			
		
	
		
			
				
					|  |  |  |         boolean b = cn.hutool.core.io.FileUtil.isFile(filePath); | 
			
		
	
		
			
				
					|  |  |  |         if(b){ | 
			
		
	
	
		
			
				
					|  |  | @ -155,6 +156,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean rebuildIndex(List<IndexObj> index) { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 重建索引命令..."); | 
			
		
	
		
			
				
					|  |  |  |         boolean retBool = false; | 
			
		
	
		
			
				
					|  |  |  |         WinServiceTool.WindowsService ws = WinServiceTool.getService(AppCfg.DB, AppCfg.CODE); | 
			
		
	
		
			
				
					|  |  |  |         if(ws.getRunningStatus() == WinServiceTool.WindowsService.ServiceState.RUNNING){ | 
			
		
	
	
		
			
				
					|  |  | @ -192,6 +194,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean setDbSize(int ...size) { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 设置数据库内存命令..."); | 
			
		
	
		
			
				
					|  |  |  |         if(size == null || size.length!=1){ | 
			
		
	
		
			
				
					|  |  |  |             log.error("请检测参数是否正确..."); | 
			
		
	
		
			
				
					|  |  |  |             return false; | 
			
		
	
	
		
			
				
					|  |  | @ -218,6 +221,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean cleanDbCache(List<String> sqls, List<TabColObj> tabColObjs) { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 清除垃圾数据命令..."); | 
			
		
	
		
			
				
					|  |  |  |         boolean retBool = false; | 
			
		
	
		
			
				
					|  |  |  |         WinServiceTool.WindowsService ws = WinServiceTool.getService(AppCfg.DB, AppCfg.CODE); | 
			
		
	
		
			
				
					|  |  |  |         if(ws.getRunningStatus() == WinServiceTool.WindowsService.ServiceState.RUNNING) { | 
			
		
	
	
		
			
				
					|  |  | @ -254,6 +258,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean registrationDbService() { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 数据库服务注册命令..."); | 
			
		
	
		
			
				
					|  |  |  |         if(WinCommandUtil.RegisterUtil.registerWindows( | 
			
		
	
		
			
				
					|  |  |  |                 String.format("SYSTEM\\ControlSet001\\Services\\%s", AppCfg.DB), | 
			
		
	
		
			
				
					|  |  |  |                 AppCfg.DB, | 
			
		
	
	
		
			
				
					|  |  | @ -275,7 +280,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean cleanMwCache() { | 
			
		
	
		
			
				
					|  |  |  |         log.info("停止 中间件 服务..."); | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 清楚应用缓存命令..."); | 
			
		
	
		
			
				
					|  |  |  |         WinServiceTool.WindowsService ws = WinServiceTool.getService(AppCfg.MW, AppCfg.CODE); | 
			
		
	
		
			
				
					|  |  |  |         if(ws.getRunningStatus() == WinServiceTool.WindowsService.ServiceState.RUNNING){ | 
			
		
	
		
			
				
					|  |  |  |             if (canNotRun(ws, WinServiceTool.WindowsService::stopService)) { | 
			
		
	
	
		
			
				
					|  |  | @ -314,6 +319,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean setMwSize(int ...size) { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 设置应用内存命令..."); | 
			
		
	
		
			
				
					|  |  |  |         if(size == null || size.length!=4){ | 
			
		
	
		
			
				
					|  |  |  |             log.error("请检测参数是否正确..."); | 
			
		
	
		
			
				
					|  |  |  |             return false; | 
			
		
	
	
		
			
				
					|  |  | @ -339,6 +345,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean registrationMwService() { | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 注册应用服务命令..."); | 
			
		
	
		
			
				
					|  |  |  |         if(WinCommandUtil.RegisterUtil.registerWindows( | 
			
		
	
		
			
				
					|  |  |  |                 String.format("SYSTEM\\ControlSet001\\Services\\%s", AppCfg.DB), | 
			
		
	
		
			
				
					|  |  |  |                 AppCfg.MW, | 
			
		
	
	
		
			
				
					|  |  | @ -378,8 +385,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean startDbService() { | 
			
		
	
		
			
				
					|  |  |  |         boolean bool; | 
			
		
	
		
			
				
					|  |  |  |         log.info("启动 数据库 服务..."); | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 启动数据服务命令..."); | 
			
		
	
		
			
				
					|  |  |  |         WinServiceTool.WindowsService ws = WinServiceTool.getService(AppCfg.DB, AppCfg.CODE); | 
			
		
	
		
			
				
					|  |  |  |         if(ws.getRunningStatus() == WinServiceTool.WindowsService.ServiceState.STOPPED){ | 
			
		
	
		
			
				
					|  |  |  |             if (canNotRun(ws, WinServiceTool.WindowsService::startService)) { | 
			
		
	
	
		
			
				
					|  |  | @ -396,8 +402,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean stopDbService() { | 
			
		
	
		
			
				
					|  |  |  |         boolean bool; | 
			
		
	
		
			
				
					|  |  |  |         log.info("停止 数据库 服务..."); | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 停止数据库服务命令..."); | 
			
		
	
		
			
				
					|  |  |  |         WinServiceTool.WindowsService ws = WinServiceTool.getService(AppCfg.DB, AppCfg.CODE); | 
			
		
	
		
			
				
					|  |  |  |         if(ws.getRunningStatus() == WinServiceTool.WindowsService.ServiceState.RUNNING){ | 
			
		
	
		
			
				
					|  |  |  |             if (canNotRun(ws, WinServiceTool.WindowsService::stopService)) { | 
			
		
	
	
		
			
				
					|  |  | @ -409,8 +414,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean startMwService() { | 
			
		
	
		
			
				
					|  |  |  |         boolean bool; | 
			
		
	
		
			
				
					|  |  |  |         log.info("启动 中间件 服务..."); | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 启动应用服务命令..."); | 
			
		
	
		
			
				
					|  |  |  |         WinServiceTool.WindowsService ws = WinServiceTool.getService(AppCfg.MW, AppCfg.CODE); | 
			
		
	
		
			
				
					|  |  |  |         if(ws.getRunningStatus() == WinServiceTool.WindowsService.ServiceState.STOPPED){ | 
			
		
	
		
			
				
					|  |  |  |             return !canNotRun(ws, WinServiceTool.WindowsService::startService); | 
			
		
	
	
		
			
				
					|  |  | @ -423,7 +427,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public boolean stopMwService() { | 
			
		
	
		
			
				
					|  |  |  |         log.info("停止 中间件 服务..."); | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 停止应用服务命令..."); | 
			
		
	
		
			
				
					|  |  |  |         WinServiceTool.WindowsService ws = WinServiceTool.getService(AppCfg.MW, AppCfg.CODE); | 
			
		
	
		
			
				
					|  |  |  |         if(ws.getRunningStatus() == WinServiceTool.WindowsService.ServiceState.RUNNING){ | 
			
		
	
		
			
				
					|  |  |  |             if (canNotRun(ws, WinServiceTool.WindowsService::stopService)) { | 
			
		
	
	
		
			
				
					|  |  | @ -436,7 +440,7 @@ public class WindowsTomcatMysql implements Computer, Database, Middleware { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public void openServer(){ | 
			
		
	
		
			
				
					|  |  |  |         log.info("准备执行>> 打开本地服务命令..."); | 
			
		
	
		
			
				
					|  |  |  |         runShell("SERVICES.MSC"); | 
			
		
	
		
			
				
					|  |  |  |         log.info("打开本地服务完成!"); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |