Skip to content

Commit b7422bb

Browse files
committed
[1.1_dev][Taier-all] fix tenantIdentity
1 parent 6224812 commit b7422bb

File tree

4 files changed

+6
-24
lines changed

4 files changed

+6
-24
lines changed

sql/init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ CREATE TABLE `tenant` (
17091709
-- Records of tenant
17101710
-- ----------------------------
17111711
BEGIN;
1712-
INSERT INTO `tenant` VALUES (1, 'taier', NULL, '2021-08-13 16:39:40', '2021-08-13 16:39:40', 1, 0, '');
1712+
INSERT INTO `tenant` VALUES (1, 'taier', NULL, '2021-08-13 16:39:40', '2021-08-13 16:39:40', 1, 0, 'taier');
17131713
COMMIT;
17141714

17151715
-- ----------------------------

taier-data-develop/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@
9898
<artifactId>dt-insight-hive-shade</artifactId>
9999
<version>4.1.3</version>
100100
</dependency>
101-
<dependency>
102-
<groupId>org.projectlombok</groupId>
103-
<artifactId>lombok</artifactId>
104-
</dependency>
105101
</dependencies>
106102

107103
<build>

taier-data-develop/src/main/java/com/dtstack/taier/develop/controller/console/TenantController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.dtstack.taier.common.exception.ErrorCode;
2424
import com.dtstack.taier.common.exception.RdosDefineException;
2525
import com.dtstack.taier.common.lang.web.R;
26+
import com.dtstack.taier.common.util.RegexUtils;
2627
import com.dtstack.taier.dao.domain.Cluster;
2728
import com.dtstack.taier.dao.domain.Tenant;
2829
import com.dtstack.taier.dao.pager.PageResult;
@@ -102,6 +103,10 @@ public R<Void> addTenant(@RequestParam("tenantName") String tenantName,@RequestP
102103
if(StringUtils.isBlank(tenantName)){
103104
throw new RdosDefineException(ErrorCode.INVALID_PARAMETERS);
104105
}
106+
if(StringUtils.isBlank(tenantIdentity)){
107+
throw new RdosDefineException(ErrorCode.INVALID_PARAMETERS);
108+
}
109+
if (!RegexUtils.tenantName(tenantIdentity)) throw new RdosDefineException(ErrorCode.TENANT_NAME_VERIFICATION_ERROR);
105110
Tenant tenant = tenantService.findByName(tenantName.trim());
106111
if(null != tenant){
107112
throw new RdosDefineException("tenant has exist");

taier-data-develop/src/main/java/com/dtstack/taier/develop/service/console/TenantService.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525
import com.dtstack.taier.common.exception.ErrorCode;
2626
import com.dtstack.taier.common.exception.RdosDefineException;
2727
import com.dtstack.taier.dao.domain.*;
28-
import com.dtstack.taier.common.util.RegexUtils;
29-
import com.dtstack.taier.dao.domain.ClusterTenant;
30-
import com.dtstack.taier.dao.domain.Component;
31-
import com.dtstack.taier.dao.domain.Queue;
32-
import com.dtstack.taier.dao.domain.Tenant;
33-
import com.dtstack.taier.dao.domain.TenantComponent;
3428
import com.dtstack.taier.dao.mapper.ClusterTenantMapper;
3529
import com.dtstack.taier.dao.mapper.ConsoleQueueMapper;
3630
import com.dtstack.taier.dao.mapper.TenantMapper;
@@ -53,7 +47,6 @@
5347
import com.dtstack.taier.scheduler.service.ComponentService;
5448
import com.dtstack.taier.scheduler.vo.ComponentVO;
5549
import org.apache.commons.lang3.BooleanUtils;
56-
import org.apache.commons.lang3.StringUtils;
5750
import org.slf4j.Logger;
5851
import org.slf4j.LoggerFactory;
5952
import org.springframework.beans.factory.annotation.Autowired;
@@ -256,8 +249,6 @@ public Tenant findByName(String tenantName) {
256249

257250

258251
public void addTenant(String tenantName, Long createUserId,String tenantIdentity) {
259-
// pre check
260-
preCheckForAddTenant(tenantName);
261252
Tenant tenant = new Tenant();
262253
tenant.setTenantName(tenantName);
263254
tenant.setCreateUserId(createUserId);
@@ -266,16 +257,6 @@ public void addTenant(String tenantName, Long createUserId,String tenantIdentity
266257
tenantMapper.insert(tenant);
267258
}
268259

269-
private void preCheckForAddTenant(String tenantName) {
270-
if(StringUtils.isBlank(tenantName)){
271-
throw new RdosDefineException(ErrorCode.INVALID_PARAMETERS);
272-
}
273-
if (!RegexUtils.tenantName(tenantName)) throw new RdosDefineException(ErrorCode.TENANT_NAME_VERIFICATION_ERROR);
274-
Tenant tenant = findByName(tenantName.trim());
275-
if(null != tenant){
276-
throw new RdosDefineException("tenant has exist");
277-
}
278-
}
279260

280261
@Transactional(rollbackFor = Exception.class)
281262
public void initDataDevelop(Long clusterId, Long tenantId, Long userId, String tenantName, String tenantDesc, List<ComponentBindDBDTO> bindDBDTOList) throws Exception {

0 commit comments

Comments
 (0)