AlarmController.java 文件源码

java
阅读 44 收藏 0 点赞 0 评论 0

项目:iotplatform 作者:
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/alarm/highestSeverity/{entityType}/{entityId}", method = RequestMethod.GET)
@ResponseBody
public AlarmSeverity getHighestAlarmSeverity(
        @PathVariable("entityType") String strEntityType,
        @PathVariable("entityId") String strEntityId,
        @RequestParam(required = false) String searchStatus,
        @RequestParam(required = false) String status
) throws IoTPException {
    checkParameter("EntityId", strEntityId);
    checkParameter("EntityType", strEntityType);
    EntityId entityId = EntityIdFactory.getByTypeAndId(strEntityType, strEntityId);
    AlarmSearchStatus alarmSearchStatus = StringUtils.isEmpty(searchStatus) ? null : AlarmSearchStatus.valueOf(searchStatus);
    AlarmStatus alarmStatus = StringUtils.isEmpty(status) ? null : AlarmStatus.valueOf(status);
    if (alarmSearchStatus != null && alarmStatus != null) {
        throw new IoTPException("Invalid alarms search query: Both parameters 'searchStatus' " +
                "and 'status' can't be specified at the same time!", IoTPErrorCode.BAD_REQUEST_PARAMS);
    }
    checkEntityId(entityId);
    try {
        return alarmService.findHighestAlarmSeverity(entityId, alarmSearchStatus, alarmStatus);
    } catch (Exception e) {
        throw handleException(e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号