开始时间

This commit is contained in:
2025-09-08 16:12:02 +08:00
parent 1e4ee840a3
commit 870f94b2d4
4 changed files with 47 additions and 13 deletions

View File

@ -46,4 +46,5 @@ public class DeviceShareController extends BaseController {
public R<Void> deviceShare(@Validated(AddGroup.class) @RequestBody AppDeviceShareBo bo) {
return toAjax(appDeviceShareService.deviceShare(bo));
}
}

View File

@ -65,7 +65,7 @@ public class WEBDeviceController extends BaseController {
* @param deviceId
* @return
*/
@Operation(summary = "设备详情")
@Operation(summary = "设备用户详情")
@GetMapping(value = "/getDeviceUser/{deviceId}")
public R<List<AppPersonnelInfoRecords>> getDeviceUser(@PathVariable Long deviceId) {
List<AppPersonnelInfoRecords> device = deviceService.getDeviceUser(deviceId);
@ -77,12 +77,16 @@ public class WEBDeviceController extends BaseController {
* 设备操作记录
*
* @param deviceId
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@Operation(summary = "设备操作记录")
@GetMapping(value = "/getOperationRecord/{deviceId}")
public R<List<DeviceLog>> getOperationRecord(@PathVariable Long deviceId) {
List<DeviceLog> device = deviceService.getOperationRecord(deviceId);
public R<List<DeviceLog>> getOperationRecord(@PathVariable Long deviceId,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
List<DeviceLog> device = deviceService.getOperationRecord(deviceId, startTime, endTime);
return R.ok(device);
}
@ -91,16 +95,21 @@ public class WEBDeviceController extends BaseController {
* 设备告警记录
*
* @param deviceId
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@Operation(summary = "设备告警记录")
@GetMapping(value = "/getAlarmRecord/{deviceId}")
public R<List<DeviceAlarmVo>> getAlarmRecord(@PathVariable Long deviceId) {
List<DeviceAlarmVo> device = deviceService.getAlarmRecord(deviceId);
public R<List<DeviceAlarmVo>> getAlarmRecord(@PathVariable Long deviceId,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
List<DeviceAlarmVo> device = deviceService.getAlarmRecord(deviceId, startTime, endTime);
return R.ok(device);
}
}

View File

@ -53,16 +53,21 @@ public interface WEBDeviceService extends IService<Device> {
* 设备操作记录
*
* @param deviceId
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
List<DeviceLog> getOperationRecord(Long deviceId);
List<DeviceLog> getOperationRecord(Long deviceId, String startTime, String endTime);
/**
* 设备告警记录
*
* @param deviceId
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
List<DeviceAlarmVo> getAlarmRecord(Long deviceId);
List<DeviceAlarmVo> getAlarmRecord(Long deviceId, String startTime, String endTime);
}

View File

@ -1,6 +1,7 @@
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.extension.service.impl.ServiceImpl;
@ -129,10 +130,19 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
* @return
*/
@Override
public List<DeviceLog> getOperationRecord(Long deviceId) {
public List<DeviceLog> getOperationRecord(Long deviceId, String startTime, String endTime) {
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);
}
List<DeviceLog> logList = deviceLogMapper.selectList(
new QueryWrapper<DeviceLog>().eq("device_id", deviceId)
.orderByDesc("create_time"));
queryWrapper.orderByDesc("create_time"));
return logList;
}
@ -144,10 +154,19 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
* @return
*/
@Override
public List<DeviceAlarmVo> getAlarmRecord(Long deviceId) {
public List<DeviceAlarmVo> getAlarmRecord(Long deviceId, String startTime, String endTime) {
QueryWrapper<DeviceAlarm> queryWrapper = new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId);
if (StrUtil.isNotEmpty(startTime)) {
queryWrapper.ge("create_time", startTime);
}
if (StrUtil.isNotEmpty(endTime)) {
queryWrapper.le("create_time", endTime);
}
List<DeviceAlarm> alarmList = deviceAlarmMapper.selectList(
new QueryWrapper<DeviceAlarm>().eq("device_id", deviceId)
.orderByDesc("create_time"));
queryWrapper.orderByDesc("create_time"));
List<DeviceAlarmVo> deviceAlarmVoList = BeanUtil.copyToList(alarmList, DeviceAlarmVo.class);
return deviceAlarmVoList;
}