fixed query timeout exception
This commit is contained in:
parent
268b9cc468
commit
1631f80da9
@ -99,7 +99,7 @@ public class AuditLogController extends BaseController {
|
|||||||
@RequestParam(name = "actionTypes", required = false) String actionTypesStr) throws ThingsboardException {
|
@RequestParam(name = "actionTypes", required = false) String actionTypesStr) throws ThingsboardException {
|
||||||
checkParameter("CustomerId", strCustomerId);
|
checkParameter("CustomerId", strCustomerId);
|
||||||
TenantId tenantId = getCurrentUser().getTenantId();
|
TenantId tenantId = getCurrentUser().getTenantId();
|
||||||
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime);
|
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, getStartTime(startTime), getEndTime(endTime));
|
||||||
List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr);
|
List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr);
|
||||||
return checkNotNull(auditLogService.findAuditLogsByTenantIdAndCustomerId(tenantId, new CustomerId(UUID.fromString(strCustomerId)), actionTypes, pageLink));
|
return checkNotNull(auditLogService.findAuditLogsByTenantIdAndCustomerId(tenantId, new CustomerId(UUID.fromString(strCustomerId)), actionTypes, pageLink));
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ public class AuditLogController extends BaseController {
|
|||||||
@RequestParam(name = "actionTypes", required = false) String actionTypesStr) throws ThingsboardException {
|
@RequestParam(name = "actionTypes", required = false) String actionTypesStr) throws ThingsboardException {
|
||||||
checkParameter("UserId", strUserId);
|
checkParameter("UserId", strUserId);
|
||||||
TenantId tenantId = getCurrentUser().getTenantId();
|
TenantId tenantId = getCurrentUser().getTenantId();
|
||||||
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime);
|
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, getStartTime(startTime), getEndTime(endTime));
|
||||||
List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr);
|
List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr);
|
||||||
return checkNotNull(auditLogService.findAuditLogsByTenantIdAndUserId(tenantId, new UserId(UUID.fromString(strUserId)), actionTypes, pageLink));
|
return checkNotNull(auditLogService.findAuditLogsByTenantIdAndUserId(tenantId, new UserId(UUID.fromString(strUserId)), actionTypes, pageLink));
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ public class AuditLogController extends BaseController {
|
|||||||
checkParameter("EntityId", strEntityId);
|
checkParameter("EntityId", strEntityId);
|
||||||
checkParameter("EntityType", strEntityType);
|
checkParameter("EntityType", strEntityType);
|
||||||
TenantId tenantId = getCurrentUser().getTenantId();
|
TenantId tenantId = getCurrentUser().getTenantId();
|
||||||
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime);
|
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, getStartTime(startTime), getEndTime(endTime));
|
||||||
List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr);
|
List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr);
|
||||||
return checkNotNull(auditLogService.findAuditLogsByTenantIdAndEntityId(tenantId, EntityIdFactory.getByTypeAndId(strEntityType, strEntityId), actionTypes, pageLink));
|
return checkNotNull(auditLogService.findAuditLogsByTenantIdAndEntityId(tenantId, EntityIdFactory.getByTypeAndId(strEntityType, strEntityId), actionTypes, pageLink));
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ public class AuditLogController extends BaseController {
|
|||||||
@RequestParam(name = "actionTypes", required = false) String actionTypesStr) throws ThingsboardException {
|
@RequestParam(name = "actionTypes", required = false) String actionTypesStr) throws ThingsboardException {
|
||||||
TenantId tenantId = getCurrentUser().getTenantId();
|
TenantId tenantId = getCurrentUser().getTenantId();
|
||||||
List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr);
|
List<ActionType> actionTypes = parseActionTypesStr(actionTypesStr);
|
||||||
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime);
|
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, getStartTime(startTime), getEndTime(endTime));
|
||||||
return checkNotNull(auditLogService.findAuditLogsByTenantId(tenantId, actionTypes, pageLink));
|
return checkNotNull(auditLogService.findAuditLogsByTenantId(tenantId, actionTypes, pageLink));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,4 +214,18 @@ public class AuditLogController extends BaseController {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Long getStartTime(Long startTime) {
|
||||||
|
if (startTime == null) {
|
||||||
|
return 1L;
|
||||||
|
}
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long getEndTime(Long endTime) {
|
||||||
|
if (endTime == null) {
|
||||||
|
return System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user