Commit 0f0840eb3b094c5d2ffb92c6d843a0c7dd2f5019

Authored by xp.Huang
2 parents a1aa95aa cd8062fa

Merge branch 'ljl1207' into 'master'

fix: 设备配置删除异常

See merge request huang/thingsboard3.3.2!12
... ... @@ -151,10 +151,12 @@ public class YtDeviceProfileController extends BaseController {
151 151 @DeleteMapping
152 152 @ApiOperation("删除")
153 153 public void deleteDevices(@Validated({DeleteGroup.class}) @RequestBody DeleteDTO deleteDTO) throws ThingsboardException {
  154 + ytDeviceProfileService.deleteDeviceProfiles(getCurrentUser().getCurrentTenantId(), deleteDTO.getIds());
  155 +
154 156 for (String id : deleteDTO.getIds()) {
155 157 deleteTbDeviceProfile(id);
156 158 }
157   - ytDeviceProfileService.deleteDeviceProfiles(getCurrentUser().getCurrentTenantId(), deleteDTO.getIds());
  159 +
158 160 }
159 161
160 162 private void deleteTbDeviceProfile(String strDeviceProfileId) throws ThingsboardException {
... ...
... ... @@ -23,14 +23,14 @@ public class YtDevice extends TenantBaseEntity {
23 23 private JsonNode deviceInfo;
24 24
25 25 private LocalDateTime activeTime;
26   - private DeviceState deviceState;
  26 + private String deviceState;
27 27 private String profileId;
28 28 private String deviceToken;
29 29 private String tbDeviceId;
30 30 private String deviceTypeId;
31 31 private LocalDateTime lastConnectTime;
32 32 private String label;
33   - private DeviceTypeEnum deviceType;
  33 + private String deviceType;
34 34 // private DeviceCredentialsEnum deviceCredentials;
35 35 private String organizationId;
36 36 /** 告警状态:0:正常 1:告警 */
... ...
... ... @@ -139,17 +139,14 @@ public class YtDeviceProfileServiceImpl
139 139 if (count > 0) {
140 140 throw new YtDataValidationException("有设备使用待删除配置,请先删除设备或者修改设备配置");
141 141 }
142   - // TODO check if ids bind to iotfs_key_value_mapping
143   - List<UUID> deletedIds = new ArrayList<>();
  142 +
144 143 for (String id : ids) {
145   - deletedIds.add(UUID.fromString(id));
146 144 LambdaQueryWrapper filter = new QueryWrapper<AlarmProfile>()
147 145 .lambda()
148 146 .eq(AlarmProfile::getTenantId, tenantId)
149 147 .in(AlarmProfile::getDeviceProfileId, id);
150 148 alarmProfileMapper.delete(filter);
151 149 }
152   - deviceProfileDao.removeAllByIds(deletedIds);
153 150
154 151 }
155 152
... ...