Showing
3 changed files
with
17 additions
and
1 deletions
@@ -43,6 +43,8 @@ public interface DeviceProfileService { | @@ -43,6 +43,8 @@ public interface DeviceProfileService { | ||
43 | 43 | ||
44 | DeviceProfile createDefaultDeviceProfile(TenantId tenantId); | 44 | DeviceProfile createDefaultDeviceProfile(TenantId tenantId); |
45 | 45 | ||
46 | + DeviceProfile createDeviceProfile(TenantId tenantId,String name); | ||
47 | + | ||
46 | DeviceProfile findDefaultDeviceProfile(TenantId tenantId); | 48 | DeviceProfile findDefaultDeviceProfile(TenantId tenantId); |
47 | 49 | ||
48 | DeviceProfileInfo findDefaultDeviceProfileInfo(TenantId tenantId); | 50 | DeviceProfileInfo findDefaultDeviceProfileInfo(TenantId tenantId); |
@@ -215,6 +215,12 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D | @@ -215,6 +215,12 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D | ||
215 | return doCreateDefaultDeviceProfile(tenantId, "default", true); | 215 | return doCreateDefaultDeviceProfile(tenantId, "default", true); |
216 | } | 216 | } |
217 | 217 | ||
218 | + @Override | ||
219 | + public DeviceProfile createDeviceProfile(TenantId tenantId, String name) { | ||
220 | + log.trace("Executing createDeviceProfile tenantId [{}]", tenantId); | ||
221 | + return doCreateDefaultDeviceProfile(tenantId, name, false); | ||
222 | + } | ||
223 | + | ||
218 | private DeviceProfile doCreateDefaultDeviceProfile(TenantId tenantId, String profileName, boolean defaultProfile) { | 224 | private DeviceProfile doCreateDefaultDeviceProfile(TenantId tenantId, String profileName, boolean defaultProfile) { |
219 | validateId(tenantId, INCORRECT_TENANT_ID + tenantId); | 225 | validateId(tenantId, INCORRECT_TENANT_ID + tenantId); |
220 | DeviceProfile deviceProfile = new DeviceProfile(); | 226 | DeviceProfile deviceProfile = new DeviceProfile(); |
@@ -140,8 +140,16 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe | @@ -140,8 +140,16 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe | ||
140 | 140 | ||
141 | //Thingskit function | 141 | //Thingskit function |
142 | DeviceProfile deviceProfile = deviceProfileService.createDefaultDeviceProfile(savedTenant.getId()); | 142 | DeviceProfile deviceProfile = deviceProfileService.createDefaultDeviceProfile(savedTenant.getId()); |
143 | - DeviceProfileDTO profileDTO = new DeviceProfileDTO(deviceProfile.getName(),deviceProfile.getTenantId(),deviceProfile.getId(), DeviceTypeEnum.DIRECT_CONNECTION); | 143 | + DeviceProfileDTO profileDTO = new DeviceProfileDTO(deviceProfile.getName(),deviceProfile.getTenantId(),deviceProfile.getId(), DeviceTypeEnum.SENSOR); |
144 | ytDeviceProfileService.insertOrUpdate(profileDTO); | 144 | ytDeviceProfileService.insertOrUpdate(profileDTO); |
145 | + DeviceProfile gatewayProfile = deviceProfileService.createDeviceProfile(savedTenant.getId(),"默认MQTT网关设备"); | ||
146 | + DeviceProfileDTO gatewayDTO = new DeviceProfileDTO(gatewayProfile.getName(),gatewayProfile.getTenantId(),gatewayProfile.getId(), DeviceTypeEnum.GATEWAY); | ||
147 | + ytDeviceProfileService.insertOrUpdate(gatewayDTO); | ||
148 | + DeviceProfile directProfile = deviceProfileService.createDeviceProfile(savedTenant.getId(),"默认MQTT直连设备"); | ||
149 | + DeviceProfileDTO directDTO = new DeviceProfileDTO(directProfile.getName(),directProfile.getTenantId(),directProfile.getId(), DeviceTypeEnum.DIRECT_CONNECTION); | ||
150 | + ytDeviceProfileService.insertOrUpdate(directDTO); | ||
151 | + | ||
152 | + | ||
145 | apiUsageStateService.createDefaultApiUsageState(savedTenant.getId(), null); | 153 | apiUsageStateService.createDefaultApiUsageState(savedTenant.getId(), null); |
146 | 154 | ||
147 | } | 155 | } |