|
@@ -124,10 +124,13 @@ public class UsersService extends BaseService {
|
|
|
userMapper.insert(user);
|
|
|
|
|
|
Tenant tenant = tenantMapper.queryById(tenantId);
|
|
|
-
|
|
|
+
|
|
|
if (PropertyUtils.getResUploadStartupState()){
|
|
|
- String userPath = HadoopUtils.getHdfsDataBasePath() + "/" + tenant.getTenantCode() + "/home/" + user.getId();
|
|
|
-
|
|
|
+
|
|
|
+ if (!HadoopUtils.getInstance().exists(HadoopUtils.getHdfsTenantDir(tenant.getTenantCode()))){
|
|
|
+ createTenantDirIfNotExists(tenant.getTenantCode());
|
|
|
+ }
|
|
|
+ String userPath = HadoopUtils.getHdfsUserDir(tenant.getTenantCode(),user.getId());
|
|
|
HadoopUtils.getInstance().mkdir(userPath);
|
|
|
}
|
|
|
|
|
@@ -247,11 +250,12 @@ public class UsersService extends BaseService {
|
|
|
|
|
|
if (PropertyUtils.getResUploadStartupState() && oldTenant != null){
|
|
|
String newTenantCode = newTenant.getTenantCode();
|
|
|
- String oldResourcePath = HadoopUtils.getHdfsDataBasePath() + "/" + oldTenant.getTenantCode() + "/resources";
|
|
|
+ String oldResourcePath = HadoopUtils.getHdfsResDir(oldTenant.getTenantCode());
|
|
|
String oldUdfsPath = HadoopUtils.getHdfsUdfDir(oldTenant.getTenantCode());
|
|
|
|
|
|
+
|
|
|
if (HadoopUtils.getInstance().exists(oldResourcePath)){
|
|
|
- String newResourcePath = HadoopUtils.getHdfsDataBasePath() + "/" + newTenantCode + "/resources";
|
|
|
+ String newResourcePath = HadoopUtils.getHdfsResDir(newTenantCode);
|
|
|
String newUdfsPath = HadoopUtils.getHdfsUdfDir(newTenantCode);
|
|
|
|
|
|
|
|
@@ -271,13 +275,22 @@ public class UsersService extends BaseService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- String oldUserPath = HadoopUtils.getHdfsDataBasePath() + "/" + oldTenant.getTenantCode() + "/home/" + userId;
|
|
|
+ String oldUserPath = HadoopUtils.getHdfsUserDir(oldTenant.getTenantCode(),userId);
|
|
|
HadoopUtils.getInstance().delete(oldUserPath, true);
|
|
|
+ }else {
|
|
|
+
|
|
|
+ createTenantDirIfNotExists(oldTenant.getTenantCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (HadoopUtils.getInstance().exists(HadoopUtils.getHdfsTenantDir(newTenant.getTenantCode()))){
|
|
|
+
|
|
|
+ String newUserPath = HadoopUtils.getHdfsUserDir(newTenant.getTenantCode(),user.getId());
|
|
|
+ HadoopUtils.getInstance().mkdir(newUserPath);
|
|
|
+ }else {
|
|
|
+
|
|
|
+ createTenantDirIfNotExists(newTenant.getTenantCode());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- String newUserPath = HadoopUtils.getHdfsDataBasePath() + "/" + newTenant.getTenantCode() + "/home/" + user.getId();
|
|
|
- HadoopUtils.getInstance().mkdir(newUserPath);
|
|
|
}
|
|
|
}
|
|
|
user.setTenantId(tenantId);
|