|
@@ -44,6 +44,7 @@ import vip.xiaonuo.common.page.CommonPageRequest;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* 监控对象管理Service接口实现类
|
|
@@ -67,10 +68,10 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
public Page<MonitorTarget> page(MonitorTargetPageParam monitorTargetPageParam) {
|
|
|
SaBaseLoginUser loginUser = StpLoginUserUtil.getLoginUser();
|
|
|
QueryWrapper<MonitorTarget> queryWrapper = new QueryWrapper<MonitorTarget>().checkSqlInjection();
|
|
|
- if (ObjectUtil.isNotEmpty(monitorTargetPageParam.getName())) {
|
|
|
+ if (StrUtil.isNotBlank(monitorTargetPageParam.getName())) {
|
|
|
queryWrapper.lambda().like(MonitorTarget::getName, monitorTargetPageParam.getName());
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(monitorTargetPageParam.getRoomId())) {
|
|
|
+ if (StrUtil.isNotBlank(monitorTargetPageParam.getRoomId())) {
|
|
|
queryWrapper.lambda().eq(MonitorTarget::getRoomId, monitorTargetPageParam.getRoomId());
|
|
|
}
|
|
|
if (ObjectUtil.isAllNotEmpty(monitorTargetPageParam.getSortField(), monitorTargetPageParam.getSortOrder())) {
|
|
@@ -84,7 +85,7 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
//获取设备区域列表并赋值返回
|
|
|
page.getRecords().forEach(monitorTarget -> {
|
|
|
monitorTarget.setMonitorTargetRegionList(monitorTargetRegionService.getRegionListByTargetId(monitorTarget.getId()));
|
|
|
- monitorTarget.setCreateOrgName(loginUser.getOrgName());
|
|
|
+ monitorTarget.setRoomName(targetRoomService.queryEntity(monitorTarget.getRoomId()).getName());
|
|
|
});
|
|
|
return page;
|
|
|
}
|
|
@@ -189,15 +190,18 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
@Override
|
|
|
public Page<MonitorTarget> getPageByUser(MonitorTargetPageParam monitorTargetPageParam) {
|
|
|
QueryWrapper<MonitorTarget> queryWrapper = new QueryWrapper<MonitorTarget>().checkSqlInjection();
|
|
|
- if (ObjectUtil.isNotEmpty(monitorTargetPageParam.getName())) {
|
|
|
+ if (StrUtil.isNotBlank(monitorTargetPageParam.getName())) {
|
|
|
queryWrapper.lambda().like(MonitorTarget::getName, monitorTargetPageParam.getName());
|
|
|
}
|
|
|
- if (ObjectUtil.isNotNull(monitorTargetPageParam.getUserId())) {
|
|
|
+ if (StrUtil.isNotBlank(monitorTargetPageParam.getUserId())) {
|
|
|
queryWrapper.lambda().eq(MonitorTarget::getCreateUser, monitorTargetPageParam.getUserId());
|
|
|
}
|
|
|
- if (ObjectUtil.isNull(monitorTargetPageParam.getOrgId())) {
|
|
|
+ if (StrUtil.isNotBlank(monitorTargetPageParam.getRoomId())) {
|
|
|
+ queryWrapper.lambda().eq(MonitorTarget::getRoomId, monitorTargetPageParam.getRoomId());
|
|
|
+ }
|
|
|
+ if (StrUtil.isBlank(monitorTargetPageParam.getOrgId())) {
|
|
|
queryWrapper.lambda().eq(MonitorTarget::getCreateOrg, StpLoginUserUtil.getLoginUser().getOrgId());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
queryWrapper.lambda().eq(MonitorTarget::getCreateOrg, monitorTargetPageParam.getOrgId());
|
|
|
}
|
|
|
if (ObjectUtil.isAllNotEmpty(monitorTargetPageParam.getSortField(), monitorTargetPageParam.getSortOrder())) {
|
|
@@ -218,9 +222,9 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public TargetStatus getTargetCount(String name) {
|
|
|
+ public TargetStatus getTargetCount(String name, String roomId) {
|
|
|
SaBaseLoginUser loginUser = StpLoginUserUtil.getLoginUser();
|
|
|
- List<StatusCount> countByStatusList = monitorTargetMapper.getCountByStatus(name,loginUser.getOrgId());
|
|
|
+ List<StatusCount> countByStatusList = monitorTargetMapper.getCountByStatus(name, roomId, loginUser.getOrgId());
|
|
|
Long total = 0L;
|
|
|
Long online = 0L;
|
|
|
Long offline = 0L;
|
|
@@ -270,14 +274,14 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<MonitorTarget> myList(Boolean isAll) {
|
|
|
+ public List<MonitorTarget> myList(Boolean isAll) {
|
|
|
SaBaseLoginUser loginUser = StpLoginUserUtil.getLoginUser();
|
|
|
LambdaQueryWrapper<MonitorTarget> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
if (!isAll) {
|
|
|
queryWrapper.eq(MonitorTarget::getStatus, MonitorStatusEnum.ONLINE.getCode())
|
|
|
.orderByDesc(MonitorTarget::getCreateTime);
|
|
|
}
|
|
|
- queryWrapper.eq(MonitorTarget::getCreateOrg,loginUser.getOrgId()).eq(MonitorTarget::getDeleteFlag, CommonDeleteFlagEnum.NOT_DELETE);
|
|
|
+ queryWrapper.eq(MonitorTarget::getCreateOrg, loginUser.getOrgId()).eq(MonitorTarget::getDeleteFlag, CommonDeleteFlagEnum.NOT_DELETE);
|
|
|
return list(queryWrapper);
|
|
|
}
|
|
|
|