Unassign assets from removed customer.
This commit is contained in:
parent
d8d84b6868
commit
4af989c278
@ -28,6 +28,7 @@ import org.thingsboard.server.common.data.id.CustomerId;
|
|||||||
import org.thingsboard.server.common.data.id.TenantId;
|
import org.thingsboard.server.common.data.id.TenantId;
|
||||||
import org.thingsboard.server.common.data.page.TextPageData;
|
import org.thingsboard.server.common.data.page.TextPageData;
|
||||||
import org.thingsboard.server.common.data.page.TextPageLink;
|
import org.thingsboard.server.common.data.page.TextPageLink;
|
||||||
|
import org.thingsboard.server.dao.asset.AssetService;
|
||||||
import org.thingsboard.server.dao.dashboard.DashboardService;
|
import org.thingsboard.server.dao.dashboard.DashboardService;
|
||||||
import org.thingsboard.server.dao.device.DeviceService;
|
import org.thingsboard.server.dao.device.DeviceService;
|
||||||
import org.thingsboard.server.dao.entity.AbstractEntityService;
|
import org.thingsboard.server.dao.entity.AbstractEntityService;
|
||||||
@ -60,6 +61,9 @@ public class CustomerServiceImpl extends AbstractEntityService implements Custom
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TenantDao tenantDao;
|
private TenantDao tenantDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AssetService assetService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceService deviceService;
|
private DeviceService deviceService;
|
||||||
|
|
||||||
@ -96,6 +100,7 @@ public class CustomerServiceImpl extends AbstractEntityService implements Custom
|
|||||||
throw new IncorrectParameterException("Unable to delete non-existent customer.");
|
throw new IncorrectParameterException("Unable to delete non-existent customer.");
|
||||||
}
|
}
|
||||||
dashboardService.unassignCustomerDashboards(customer.getTenantId(), customerId);
|
dashboardService.unassignCustomerDashboards(customer.getTenantId(), customerId);
|
||||||
|
assetService.unassignCustomerAssets(customer.getTenantId(), customerId);
|
||||||
deviceService.unassignCustomerDevices(customer.getTenantId(), customerId);
|
deviceService.unassignCustomerDevices(customer.getTenantId(), customerId);
|
||||||
userService.deleteCustomerUsers(customer.getTenantId(), customerId);
|
userService.deleteCustomerUsers(customer.getTenantId(), customerId);
|
||||||
deleteEntityRelations(customerId);
|
deleteEntityRelations(customerId);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user