添加日志存储与查询功能
登录接口返回用户详细信息
This commit is contained in:
34
src/main/java/com/genersoft/iot/vmp/service/ILogService.java
Normal file
34
src/main/java/com/genersoft/iot/vmp/service/ILogService.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.genersoft.iot.vmp.service;
|
||||
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
/**
|
||||
* 系统日志
|
||||
*/
|
||||
public interface ILogService {
|
||||
|
||||
/**
|
||||
* 查询日志
|
||||
* @param page 当前页
|
||||
* @param count 每页数量
|
||||
* @param query 搜索内容
|
||||
* @param type 类型
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 日志列表
|
||||
*/
|
||||
PageInfo<LogDto> getAll(int page, int count, String query, String type, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 添加日志
|
||||
* @param logDto 日志
|
||||
*/
|
||||
void add(LogDto logDto);
|
||||
|
||||
/**
|
||||
* 清空
|
||||
*/
|
||||
int clear();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import com.genersoft.iot.vmp.service.ILogService;
|
||||
import com.genersoft.iot.vmp.storager.dao.LogMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.LogDto;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class LogServiceImpl implements ILogService {
|
||||
|
||||
@Autowired
|
||||
private LogMapper logMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<LogDto> getAll(int page, int count, String query, String type, String startTime, String endTime) {
|
||||
PageHelper.startPage(page, count);
|
||||
List<LogDto> all = logMapper.query(query, type, startTime, endTime);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(LogDto logDto) {
|
||||
logMapper.add(logDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int clear() {
|
||||
return logMapper.clear();
|
||||
}
|
||||
}
|
||||
@@ -342,12 +342,14 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
|
||||
|
||||
if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) {
|
||||
logger.info("获取负载最低的节点时无在线节点");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取分数最低的,及并发最低的
|
||||
Set<Object> objects = redisUtil.ZRange(key, 0, -1);
|
||||
ArrayList<Object> MediaServerObjectS = new ArrayList<>(objects);
|
||||
String mediaServerId = (String)MediaServerObjectS.get(0);
|
||||
ArrayList<Object> mediaServerObjectS = new ArrayList<>(objects);
|
||||
|
||||
String mediaServerId = (String)mediaServerObjectS.get(0);
|
||||
return getOne(mediaServerId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user