Merge branch 'dyf-device' into 6170
# Conflicts: # fys-admin/src/main/java/com/fuyuanshen/web/controller/device/DeviceShareController.java
This commit is contained in:
@ -53,16 +53,21 @@ public interface WEBDeviceService extends IService<Device> {
|
||||
* 设备操作记录
|
||||
*
|
||||
* @param deviceId
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
List<DeviceLog> getOperationRecord(Long deviceId);
|
||||
TableDataInfo<DeviceLog> getOperationRecord(Long deviceId, String startTime, String endTime, PageQuery pageQuery);
|
||||
|
||||
|
||||
/**
|
||||
* 设备告警记录
|
||||
*
|
||||
* @param deviceId
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
List<DeviceAlarmVo> getAlarmRecord(Long deviceId);
|
||||
TableDataInfo<DeviceAlarmVo> getAlarmRecord(Long deviceId, String startTime, String endTime, PageQuery pageQuery);
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +1,20 @@
|
||||
package com.fuyuanshen.web.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuyuanshen.app.domain.AppDeviceBindRecord;
|
||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
|
||||
import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper;
|
||||
import com.fuyuanshen.app.mapper.AppDeviceShareMapper;
|
||||
import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.DeviceAlarm;
|
||||
import com.fuyuanshen.equipment.domain.DeviceAssignments;
|
||||
@ -23,7 +27,6 @@ import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceLogMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||
import com.fuyuanshen.web.service.WEBDeviceService;
|
||||
import com.fuyuanshen.web.service.device.DeviceBizService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -129,11 +132,19 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceLog> getOperationRecord(Long deviceId) {
|
||||
List<DeviceLog> logList = deviceLogMapper.selectList(
|
||||
new QueryWrapper<DeviceLog>().eq("device_id", deviceId)
|
||||
.orderByDesc("create_time"));
|
||||
return logList;
|
||||
public TableDataInfo<DeviceLog> getOperationRecord(Long deviceId, String startTime, String endTime, PageQuery pageQuery) {
|
||||
Page<DeviceLog> page = pageQuery.build();
|
||||
QueryWrapper<DeviceLog> queryWrapper = new QueryWrapper<DeviceLog>().eq("device_id", deviceId);
|
||||
|
||||
if (StrUtil.isNotEmpty(startTime)) {
|
||||
queryWrapper.ge("create_time", startTime);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(endTime)) {
|
||||
queryWrapper.le("create_time", endTime);
|
||||
}
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
IPage<DeviceLog> logList = deviceLogMapper.selectPage(page, queryWrapper);
|
||||
return TableDataInfo.build(logList);
|
||||
}
|
||||
|
||||
|
||||
@ -144,13 +155,23 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceAlarmVo> getAlarmRecord(Long deviceId) {
|
||||
List<DeviceAlarm> alarmList = deviceAlarmMapper.selectList(
|
||||
new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId)
|
||||
.orderByDesc("create_time"));
|
||||
List<DeviceAlarmVo> deviceAlarmVoList = BeanUtil.copyToList(alarmList, DeviceAlarmVo.class);
|
||||
return deviceAlarmVoList;
|
||||
public TableDataInfo getAlarmRecord(Long deviceId, String startTime, String endTime, PageQuery pageQuery) {
|
||||
Page<DeviceAlarm> page = pageQuery.build();
|
||||
QueryWrapper<DeviceAlarm> queryWrapper = new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId);
|
||||
|
||||
if (StrUtil.isNotEmpty(startTime)) {
|
||||
queryWrapper.ge("start_time", startTime);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(endTime)) {
|
||||
queryWrapper.le("start_time", endTime);
|
||||
}
|
||||
queryWrapper.orderByDesc("start_time");
|
||||
IPage<DeviceAlarm> alarmPage = deviceAlarmMapper.selectPage(page, queryWrapper);
|
||||
|
||||
// List<DeviceAlarmVo> deviceAlarmVoList = BeanUtil.copyToList(alarmPage.getRecords(), DeviceAlarmVo.class);
|
||||
return TableDataInfo.build(alarmPage);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user