Showing
1 changed file
with
12 additions
and
2 deletions
@@ -19,12 +19,15 @@ import com.google.common.util.concurrent.ListenableFuture; | @@ -19,12 +19,15 @@ import com.google.common.util.concurrent.ListenableFuture; | ||
19 | import lombok.extern.slf4j.Slf4j; | 19 | import lombok.extern.slf4j.Slf4j; |
20 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
21 | import org.springframework.stereotype.Service; | 21 | import org.springframework.stereotype.Service; |
22 | +import org.thingsboard.server.common.data.DeviceProfile; | ||
22 | import org.thingsboard.server.common.data.Tenant; | 23 | import org.thingsboard.server.common.data.Tenant; |
23 | import org.thingsboard.server.common.data.TenantInfo; | 24 | import org.thingsboard.server.common.data.TenantInfo; |
24 | import org.thingsboard.server.common.data.TenantProfile; | 25 | import org.thingsboard.server.common.data.TenantProfile; |
25 | import org.thingsboard.server.common.data.id.TenantId; | 26 | import org.thingsboard.server.common.data.id.TenantId; |
26 | import org.thingsboard.server.common.data.page.PageData; | 27 | import org.thingsboard.server.common.data.page.PageData; |
27 | import org.thingsboard.server.common.data.page.PageLink; | 28 | import org.thingsboard.server.common.data.page.PageLink; |
29 | +import org.thingsboard.server.common.data.yunteng.dto.DeviceProfileDTO; | ||
30 | +import org.thingsboard.server.common.data.yunteng.enums.DeviceTypeEnum; | ||
28 | import org.thingsboard.server.dao.asset.AssetService; | 31 | import org.thingsboard.server.dao.asset.AssetService; |
29 | import org.thingsboard.server.dao.customer.CustomerService; | 32 | import org.thingsboard.server.dao.customer.CustomerService; |
30 | import org.thingsboard.server.dao.dashboard.DashboardService; | 33 | import org.thingsboard.server.dao.dashboard.DashboardService; |
@@ -42,6 +45,7 @@ import org.thingsboard.server.dao.service.Validator; | @@ -42,6 +45,7 @@ import org.thingsboard.server.dao.service.Validator; | ||
42 | import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; | 45 | import org.thingsboard.server.dao.usagerecord.ApiUsageStateService; |
43 | import org.thingsboard.server.dao.user.UserService; | 46 | import org.thingsboard.server.dao.user.UserService; |
44 | import org.thingsboard.server.dao.widget.WidgetsBundleService; | 47 | import org.thingsboard.server.dao.widget.WidgetsBundleService; |
48 | +import org.thingsboard.server.dao.yunteng.service.YtDeviceProfileService; | ||
45 | 49 | ||
46 | import static org.thingsboard.server.dao.service.Validator.validateId; | 50 | import static org.thingsboard.server.dao.service.Validator.validateId; |
47 | 51 | ||
@@ -99,7 +103,8 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe | @@ -99,7 +103,8 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe | ||
99 | 103 | ||
100 | @Autowired | 104 | @Autowired |
101 | private DataValidator<Tenant> tenantValidator; | 105 | private DataValidator<Tenant> tenantValidator; |
102 | - | 106 | + @Autowired |
107 | + private YtDeviceProfileService ytDeviceProfileService; | ||
103 | @Override | 108 | @Override |
104 | public Tenant findTenantById(TenantId tenantId) { | 109 | public Tenant findTenantById(TenantId tenantId) { |
105 | log.trace("Executing findTenantById [{}]", tenantId); | 110 | log.trace("Executing findTenantById [{}]", tenantId); |
@@ -132,8 +137,13 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe | @@ -132,8 +137,13 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe | ||
132 | tenantValidator.validate(tenant, Tenant::getId); | 137 | tenantValidator.validate(tenant, Tenant::getId); |
133 | Tenant savedTenant = tenantDao.save(tenant.getId(), tenant); | 138 | Tenant savedTenant = tenantDao.save(tenant.getId(), tenant); |
134 | if (tenant.getId() == null) { | 139 | if (tenant.getId() == null) { |
135 | - deviceProfileService.createDefaultDeviceProfile(savedTenant.getId()); | 140 | + |
141 | + //Thingskit function | ||
142 | + DeviceProfile deviceProfile = deviceProfileService.createDefaultDeviceProfile(savedTenant.getId()); | ||
143 | + DeviceProfileDTO profileDTO = new DeviceProfileDTO(deviceProfile.getName(),deviceProfile.getTenantId(),deviceProfile.getId(), DeviceTypeEnum.DIRECT_CONNECTION); | ||
144 | + ytDeviceProfileService.insertOrUpdate(profileDTO); | ||
136 | apiUsageStateService.createDefaultApiUsageState(savedTenant.getId(), null); | 145 | apiUsageStateService.createDefaultApiUsageState(savedTenant.getId(), null); |
146 | + | ||
137 | } | 147 | } |
138 | return savedTenant; | 148 | return savedTenant; |
139 | } | 149 | } |