|
@ -64,8 +64,10 @@ public class WindowsTomcatMysql extends Computer implements Database, Middleware |
|
|
|
|
|
|
|
|
log.info("启动 数据库 服务..."); |
|
|
log.info("启动 数据库 服务..."); |
|
|
ws.startService(); |
|
|
ws.startService(); |
|
|
|
|
|
retBool = true; |
|
|
|
|
|
} else { |
|
|
|
|
|
retBool = false; |
|
|
} |
|
|
} |
|
|
retBool = true; |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
retBool = false; |
|
|
retBool = false; |
|
|
} |
|
|
} |
|
@ -91,11 +93,33 @@ public class WindowsTomcatMysql extends Computer implements Database, Middleware |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public boolean runRestore(String path) { |
|
|
public boolean runRestore(String path) throws Exception { |
|
|
boolean retBool; |
|
|
boolean retBool; |
|
|
boolean b = cn.hutool.core.io.FileUtil.isFile(path); |
|
|
boolean b = cn.hutool.core.io.FileUtil.isFile(path); |
|
|
if(b){ |
|
|
if(b){ |
|
|
|
|
|
String namePath = path.substring(0, path.indexOf(".gz")); |
|
|
|
|
|
String picPath = File.separatorChar + "tomcat8" + File.separatorChar + "HZBPHOTOS"; |
|
|
|
|
|
String dbPath = AppCfg.HZB + File.separatorChar + "mysql" + File.separatorChar + "data"; |
|
|
log.info("判断文件:{}...存在:{}", path, b); |
|
|
log.info("判断文件:{}...存在:{}", path, b); |
|
|
|
|
|
log.info("解压文件..."); |
|
|
|
|
|
ZipUtil.unZip7Z(path, namePath); |
|
|
|
|
|
|
|
|
|
|
|
WinServiceTool.WindowsService ws = WinServiceTool.getService(AppCfg.DB, AppCfg.CODE); |
|
|
|
|
|
if(ws.getRunningStatus() == WinServiceTool.WindowsService.ServiceState.RUNNING){ |
|
|
|
|
|
ws.stopService(); |
|
|
|
|
|
} |
|
|
|
|
|
log.info("删除原数据文件..."); |
|
|
|
|
|
cn.hutool.core.io.FileUtil.del(dbPath); |
|
|
|
|
|
|
|
|
|
|
|
log.info("解压数据库文件..."); |
|
|
|
|
|
ZipUtil.unZip7Z(namePath + File.separatorChar + "data", dbPath); |
|
|
|
|
|
|
|
|
|
|
|
log.info("删除原照片文件..."); |
|
|
|
|
|
cn.hutool.core.io.FileUtil.del(AppCfg.HZB + picPath); |
|
|
|
|
|
|
|
|
|
|
|
log.info("移动照片文件..."); |
|
|
|
|
|
cn.hutool.core.io.FileUtil.copy(namePath + picPath, AppCfg.HZB + picPath, true); |
|
|
|
|
|
ws.startService(); |
|
|
retBool = true; |
|
|
retBool = true; |
|
|
}else{ |
|
|
}else{ |
|
|
log.error("判断文件:{}...不存在,请检查!", path); |
|
|
log.error("判断文件:{}...不存在,请检查!", path); |
|
|