|
@@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.device.profile.*; |
|
@@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.device.profile.*; |
19
|
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
19
|
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
20
|
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
20
|
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
21
|
import org.thingsboard.server.common.data.id.DeviceProfileId;
|
21
|
import org.thingsboard.server.common.data.id.DeviceProfileId;
|
|
|
22
|
+import org.thingsboard.server.common.data.id.RuleChainId;
|
22
|
import org.thingsboard.server.common.data.id.TenantId;
|
23
|
import org.thingsboard.server.common.data.id.TenantId;
|
23
|
import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent;
|
24
|
import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent;
|
24
|
import org.thingsboard.server.common.data.yunteng.common.DeleteGroup;
|
25
|
import org.thingsboard.server.common.data.yunteng.common.DeleteGroup;
|
|
@@ -68,7 +69,7 @@ public class YtDeviceProfileController extends BaseController { |
|
@@ -68,7 +69,7 @@ public class YtDeviceProfileController extends BaseController { |
68
|
|
69
|
|
69
|
//TODO 3/3.处理业务平台的业务逻辑
|
70
|
//TODO 3/3.处理业务平台的业务逻辑
|
70
|
|
71
|
|
71
|
- DeviceProfileDTO newDeviceProfileDTO = ytDeviceProfileService.insertOrUpdate(getCurrentUser().getCurrentTenantId(), deviceProfileDTO);
|
72
|
+ DeviceProfileDTO newDeviceProfileDTO = ytDeviceProfileService.insertOrUpdate(savedDeviceProfile.getId().getId().toString(), deviceProfileDTO);
|
72
|
return Optional.ofNullable(newDeviceProfileDTO)
|
73
|
return Optional.ofNullable(newDeviceProfileDTO)
|
73
|
.map(
|
74
|
.map(
|
74
|
dto -> {
|
75
|
dto -> {
|
|
@@ -191,21 +192,27 @@ public class YtDeviceProfileController extends BaseController { |
|
@@ -191,21 +192,27 @@ public class YtDeviceProfileController extends BaseController { |
191
|
// 传输类型默认都是Default
|
192
|
// 传输类型默认都是Default
|
192
|
tbDeviceProfile.setTransportType(DeviceTransportType.DEFAULT);
|
193
|
tbDeviceProfile.setTransportType(DeviceTransportType.DEFAULT);
|
193
|
// 获取当前租户的默认规则链
|
194
|
// 获取当前租户的默认规则链
|
194
|
-// tbDeviceProfile.setDefaultRuleChainId(new RuleChainId(getCurrentUserDefaultRuleChains()));
|
195
|
+ if(StringUtils.isNotBlank(deviceProfileDTO.getDefaultRuleChainId())){
|
|
|
196
|
+ UUID chainId = UUID.fromString(deviceProfileDTO.getDefaultRuleChainId());
|
|
|
197
|
+ tbDeviceProfile.setDefaultRuleChainId(new RuleChainId(chainId));
|
|
|
198
|
+ }
|
|
|
199
|
+
|
195
|
tbDeviceProfile.setDefaultQueueName(ServiceQueue.MAIN);
|
200
|
tbDeviceProfile.setDefaultQueueName(ServiceQueue.MAIN);
|
196
|
tbDeviceProfile.setProvisionType(DeviceProfileProvisionType.DISABLED);
|
201
|
tbDeviceProfile.setProvisionType(DeviceProfileProvisionType.DISABLED);
|
197
|
tbDeviceProfile.setCreatedTime(LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli());
|
202
|
tbDeviceProfile.setCreatedTime(LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli());
|
|
|
203
|
+
|
198
|
DeviceProfileData deviceProfileData = new DeviceProfileData();
|
204
|
DeviceProfileData deviceProfileData = new DeviceProfileData();
|
199
|
deviceProfileData.setConfiguration(new DefaultDeviceProfileConfiguration());
|
205
|
deviceProfileData.setConfiguration(new DefaultDeviceProfileConfiguration());
|
200
|
deviceProfileData.setProvisionConfiguration(new DisabledDeviceProfileProvisionConfiguration(null));
|
206
|
deviceProfileData.setProvisionConfiguration(new DisabledDeviceProfileProvisionConfiguration(null));
|
201
|
deviceProfileData.setTransportConfiguration(new DefaultDeviceProfileTransportConfiguration());
|
207
|
deviceProfileData.setTransportConfiguration(new DefaultDeviceProfileTransportConfiguration());
|
202
|
- if (null != deviceProfileDTO.getAlarms()) {
|
|
|
203
|
- List<DeviceProfileAlarm> list = new ArrayList<>();
|
|
|
204
|
- DeviceProfileAlarm deviceProfileAlarm = JacksonUtil.convertValue(deviceProfileDTO.getAlarms(),DeviceProfileAlarm.class);
|
|
|
205
|
- list.add(deviceProfileAlarm);
|
|
|
206
|
- deviceProfileData.setAlarms(list);
|
|
|
207
|
- }
|
208
|
+ deviceProfileData.setAlarms(deviceProfileDTO.getProfileData().getAlarms());
|
|
|
209
|
+// if (null != deviceProfileDTO.getAlarms()) {
|
|
|
210
|
+// List<DeviceProfileAlarm> list = new ArrayList<>();
|
|
|
211
|
+// DeviceProfileAlarm deviceProfileAlarm = JacksonUtil.convertValue(deviceProfileDTO.getAlarms(),DeviceProfileAlarm.class);
|
|
|
212
|
+// list.add(deviceProfileAlarm);
|
|
|
213
|
+// }
|
208
|
tbDeviceProfile.setProfileData(deviceProfileData);
|
214
|
tbDeviceProfile.setProfileData(deviceProfileData);
|
|
|
215
|
+
|
209
|
return tbDeviceProfile;
|
216
|
return tbDeviceProfile;
|
210
|
}
|
217
|
}
|
211
|
} |
218
|
} |