Merge branch 'dyf-device' into 6170

# Conflicts:
#	fys-admin/src/main/java/com/fuyuanshen/web/controller/device/DeviceShareController.java
This commit is contained in:
2025-09-09 10:01:26 +08:00
5 changed files with 71 additions and 31 deletions

View File

@ -39,7 +39,7 @@ public class DeviceChargeDischargeController extends BaseController {
/**
* 查询设备充放电记录列表
*/
@SaCheckPermission("equipment:chargeDischarge:list")
// @SaCheckPermission("equipment:chargeDischarge:list")
@GetMapping("/list")
public TableDataInfo<DeviceChargeDischargeVo> list(DeviceChargeDischargeBo bo, PageQuery pageQuery) {
return deviceChargeDischargeService.queryPageList(bo, pageQuery);
@ -48,7 +48,7 @@ public class DeviceChargeDischargeController extends BaseController {
/**
* 设备充放电记录列表
*/
@SaCheckPermission("equipment:chargeDischarge:export")
// @SaCheckPermission("equipment:chargeDischarge:export")
@Log(title = "设备充放电记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(DeviceChargeDischargeBo bo, HttpServletResponse response) {
@ -61,7 +61,7 @@ public class DeviceChargeDischargeController extends BaseController {
*
* @param id 主键
*/
@SaCheckPermission("equipment:chargeDischarge:query")
// @SaCheckPermission("equipment:chargeDischarge:query")
@GetMapping("/{id}")
public R<DeviceChargeDischargeVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
@ -71,7 +71,7 @@ public class DeviceChargeDischargeController extends BaseController {
/**
* 新增设备充放电记录
*/
@SaCheckPermission("equipment:chargeDischarge:add")
// @SaCheckPermission("equipment:chargeDischarge:add")
@Log(title = "设备充放电记录", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
@ -82,7 +82,7 @@ public class DeviceChargeDischargeController extends BaseController {
/**
* 修改设备充放电记录
*/
@SaCheckPermission("equipment:chargeDischarge:edit")
// @SaCheckPermission("equipment:chargeDischarge:edit")
@Log(title = "设备充放电记录", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
@ -95,11 +95,13 @@ public class DeviceChargeDischargeController extends BaseController {
*
* @param ids 主键串
*/
@SaCheckPermission("equipment:chargeDischarge:remove")
// @SaCheckPermission("equipment:chargeDischarge:remove")
@Log(title = "设备充放电记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(deviceChargeDischargeService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@ -3,6 +3,8 @@ package com.fuyuanshen.web.controller.device;
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.web.core.BaseController;
import com.fuyuanshen.equipment.domain.DeviceLog;
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
@ -65,7 +67,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,13 +79,18 @@ 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);
return R.ok(device);
public TableDataInfo<DeviceLog> getOperationRecord(@PathVariable Long deviceId,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
PageQuery pageQuery) {
TableDataInfo<DeviceLog> device = deviceService.getOperationRecord(deviceId, startTime, endTime,pageQuery);
return device;
}
@ -91,13 +98,17 @@ 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);
return R.ok(device);
public TableDataInfo<DeviceAlarmVo> getAlarmRecord(@PathVariable Long deviceId,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
PageQuery pageQuery) {
return deviceService.getAlarmRecord(deviceId, startTime, endTime, pageQuery);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -4,7 +4,9 @@ import com.fuyuanshen.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serial;
@ -63,7 +65,6 @@ public class DeviceAlarm extends TenantEntity {
/**
* 经度
*/
private Long longitude;
@ -90,7 +91,7 @@ public class DeviceAlarm extends TenantEntity {
/**
* 报警持续时间
*/
private Long durationTime;
private String durationTime;
/**
* 0已处理1未处理