Add fix for usage load performance #265

Merged
tcdlpds merged 1 commits from osh.silva/device-mgt-core:billing-load-fix into master 1 year ago

@ -1093,10 +1093,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
public double generateCost(List<Device> allDevices, Timestamp startDate, Timestamp endDate, Cost tenantCost, List<Device> deviceStatusNotAvailable, double totalCost) throws DeviceManagementException { public double generateCost(List<Device> allDevices, Timestamp startDate, Timestamp endDate, Cost tenantCost, List<Device> deviceStatusNotAvailable, double totalCost) throws DeviceManagementException {
List<DeviceStatus> deviceStatus;
for (Device device : allDevices) { for (Device device : allDevices) {
long dateDiff = 0; long dateDiff = 0;
device.setDeviceStatusInfo(getDeviceStatusHistory(device, null, endDate, true)); deviceStatus = getDeviceStatusHistory(device, null, endDate, true);
List<DeviceStatus> deviceStatus = device.getDeviceStatusInfo();
if (device.getEnrolmentInfo().getDateOfEnrolment() < startDate.getTime()) { if (device.getEnrolmentInfo().getDateOfEnrolment() < startDate.getTime()) {
if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED")
|| String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) {

Loading…
Cancel
Save