Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-08-31 16:11:37 +08:00
commit ed29d6e0fb
3 changed files with 10 additions and 7 deletions

View File

@ -1,7 +1,6 @@
package io.renren.modules.monitor.task;
import io.renren.modules.job.task.ITask;
import io.renren.modules.monitor.service.MonitorService;
import io.renren.modules.sys.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -178,10 +178,15 @@ public class SysUserController {
}
@GetMapping("backSysUser")
public void backSysUser(){
@ApiOperation("手动执行备份sys_user表并从金宏获取用户信息增量更新到用户表中")
public Result backSysUser(){
int i = sysUserService.backSysUser();
if(i ==0){
sysUserService.getUserInfoFromJH();
return new Result().ok("更新用户已经执行");
}else{
return new Result().error();
}
}
}

View File

@ -487,13 +487,12 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
String property = System.getProperty("os.name");
System.out.println(property);
StringBuilder strBuil = new StringBuilder();
//jdbc:mysql://15.72.183.91:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&server
String host = url.substring(url.indexOf("mysql"), url.indexOf("3306")).replace(":", "").replace("//", "").replace("mysql", "");
String host = url.substring(url.indexOf("mysql"), url.indexOf("3306")).replace(":", "").replace("//", "").replace("mysql", "");
String dataName = url.substring(url.indexOf("3306"), url.indexOf("?")).replaceAll("/", "").replaceAll("3306", "");
strBuil.append("mysqldump -u").append(username).append(" -p").append(password)
.append(" -h").append(host).append(" -P3306 ").append(dataName).append(" sys_user > /data/services/sys_user.sql");
//String newCmdLinux = " mysqldump -uroot -pw@CmM1mBVQkPhdrc -h15.72.183.91 -P3306 share_platform sys_user > /data/services/sys_user.sql";
String newCmdLinux = strBuil.toString();
String newCmdWin = " cmd /c mysqldump -uroot -proot -h127.0.0.1 -P3306 share_platform sys_user > D:\\sys_user.sql";
@ -505,8 +504,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
// 本地win
process = Runtime.getRuntime().exec(newCmdWin);
}
//0 表示线程正常终止
//if (process.waitFor() == 0) {}
//process.waitFor() == 0表示执行正常
result = process.waitFor();
}catch (Exception e){
e.printStackTrace();