forked from dyf/fys-Multi-tenant
Compare commits
12 Commits
d97ace42d0
...
76e2b9de24
Author | SHA1 | Date | |
---|---|---|---|
76e2b9de24 | |||
0787e4b205 | |||
eca113d388 | |||
127e26e0d4 | |||
dfb5d8ac65 | |||
896c501cd6 | |||
d8686e3cbd | |||
c2ce9679c4 | |||
d66fb7d2c2 | |||
400c53030a | |||
b5565da752 | |||
e17a64ad57 |
@ -14,7 +14,7 @@ public class AppRealTimeStatusDto {
|
|||||||
private String deviceImei;
|
private String deviceImei;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备类型
|
* 获取实时状态类型:FunctionAccessBatchStatusRule 批量 ,FunctionAccessStatusRule 单个
|
||||||
*/
|
*/
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import com.fuyuanshen.global.mqtt.base.MqttRuleContext;
|
|||||||
import com.fuyuanshen.global.mqtt.base.MqttRuleEngine;
|
import com.fuyuanshen.global.mqtt.base.MqttRuleEngine;
|
||||||
import com.fuyuanshen.global.mqtt.base.MqttXinghanCommandType;
|
import com.fuyuanshen.global.mqtt.base.MqttXinghanCommandType;
|
||||||
import com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants;
|
import com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants;
|
||||||
|
import com.fuyuanshen.global.queue.MqttMessageQueueConstants;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.messaging.Message;
|
import org.springframework.messaging.Message;
|
||||||
@ -51,6 +52,9 @@ public class ReceiverMessageHandler implements MessageHandler {
|
|||||||
//在线状态
|
//在线状态
|
||||||
String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ deviceImei + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ;
|
String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ deviceImei + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ;
|
||||||
RedisUtils.setCacheObject(deviceOnlineStatusRedisKey, "1", Duration.ofSeconds(62));
|
RedisUtils.setCacheObject(deviceOnlineStatusRedisKey, "1", Duration.ofSeconds(62));
|
||||||
|
// String queueKey = MqttMessageQueueConstants.MQTT_MESSAGE_QUEUE_KEY;
|
||||||
|
// String dedupKey = MqttMessageQueueConstants.MQTT_MESSAGE_DEDUP_KEY;
|
||||||
|
// RedisUtils.offerDeduplicated(queueKey,dedupKey,deviceImei, Duration.ofHours(24));
|
||||||
}
|
}
|
||||||
|
|
||||||
String state = payloadDict.getStr("state");
|
String state = payloadDict.getStr("state");
|
||||||
|
@ -0,0 +1,110 @@
|
|||||||
|
package com.fuyuanshen.global.queue;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
||||||
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import jakarta.annotation.PreDestroy;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class MqttMessageConsumer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
|
// 创建两个线程池:一个用于消息获取,一个用于业务处理
|
||||||
|
private ExecutorService messageConsumerPool = Executors.newFixedThreadPool(3);
|
||||||
|
private ExecutorService messageProcessorPool = Executors.newFixedThreadPool(10);
|
||||||
|
|
||||||
|
// 初始化方法,启动消息监听
|
||||||
|
// @PostConstruct
|
||||||
|
public void start() {
|
||||||
|
log.info("启动MQTT消息消费者...");
|
||||||
|
// 启动消息获取线程
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
messageConsumerPool.submit(this::consumeMessages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 销毁方法,关闭线程池
|
||||||
|
@PreDestroy
|
||||||
|
public void stop() {
|
||||||
|
log.info("关闭MQTT消息消费者...");
|
||||||
|
shutdownExecutorService(messageConsumerPool);
|
||||||
|
shutdownExecutorService(messageProcessorPool);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shutdownExecutorService(ExecutorService executorService) {
|
||||||
|
if (executorService != null && !executorService.isShutdown()) {
|
||||||
|
executorService.shutdown();
|
||||||
|
try {
|
||||||
|
if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
|
||||||
|
executorService.shutdownNow();
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
executorService.shutdownNow();
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 消费者方法 - 专门负责从队列获取消息
|
||||||
|
public void consumeMessages() {
|
||||||
|
String queueKey = MqttMessageQueueConstants.MQTT_MESSAGE_QUEUE_KEY;
|
||||||
|
String threadName = Thread.currentThread().getName();
|
||||||
|
log.info("消息消费者线程 {} 开始监听队列: {}", threadName, queueKey);
|
||||||
|
|
||||||
|
try {
|
||||||
|
while (!Thread.currentThread().isInterrupted() && !messageConsumerPool.isShutdown()) {
|
||||||
|
// 阻塞式获取队列中的消息
|
||||||
|
String message = RedisUtils.pollDeduplicated(
|
||||||
|
queueKey,
|
||||||
|
MqttMessageQueueConstants.MQTT_MESSAGE_DEDUP_KEY,
|
||||||
|
1,
|
||||||
|
TimeUnit.SECONDS
|
||||||
|
);
|
||||||
|
|
||||||
|
if (message != null) {
|
||||||
|
log.info("线程 {} 从队列中获取到消息,提交到处理线程池: {}", threadName, message);
|
||||||
|
// 将消息处理任务提交到处理线程池
|
||||||
|
messageProcessorPool.submit(() -> processMessage(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("线程 {} 消费消息时发生错误", threadName, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("消息消费者线程 {} 停止监听队列", threadName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理具体业务逻辑的方法
|
||||||
|
private void processMessage(String message) {
|
||||||
|
String threadName = Thread.currentThread().getName();
|
||||||
|
try {
|
||||||
|
log.info("业务处理线程 {} 开始处理消息: {}", threadName, message);
|
||||||
|
|
||||||
|
// 实现具体的业务逻辑
|
||||||
|
// 例如更新数据库、发送通知等
|
||||||
|
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq("device_imei", message)
|
||||||
|
.set("online_status", 1);
|
||||||
|
deviceMapper.update(updateWrapper);
|
||||||
|
// 模拟业务处理耗时
|
||||||
|
Thread.sleep(200);
|
||||||
|
|
||||||
|
log.info("业务处理线程 {} 完成消息处理: {}", threadName, message);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("业务处理线程 {} 处理消息时发生错误: {}", threadName, message, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.fuyuanshen.global.queue;
|
||||||
|
|
||||||
|
public class MqttMessageQueueConstants {
|
||||||
|
public static final String MQTT_MESSAGE_QUEUE_KEY = "mqtt:message:queue";
|
||||||
|
public static final String MQTT_MESSAGE_DEDUP_KEY = "mqtt:message:dedup";
|
||||||
|
}
|
@ -1,26 +1,26 @@
|
|||||||
package com.fuyuanshen.web.controller.device;
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import com.fuyuanshen.common.log.annotation.Log;
|
|
||||||
import com.fuyuanshen.common.web.core.BaseController;
|
|
||||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
|
||||||
import com.fuyuanshen.common.core.domain.R;
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
|
||||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||||
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||||
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
|
import com.fuyuanshen.common.log.annotation.Log;
|
||||||
import com.fuyuanshen.equipment.service.IDeviceAlarmService;
|
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
||||||
|
import com.fuyuanshen.equipment.service.IDeviceAlarmService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备告警
|
* 设备告警
|
||||||
@ -36,6 +36,7 @@ public class DeviceAlarmController extends BaseController {
|
|||||||
|
|
||||||
private final IDeviceAlarmService deviceAlarmService;
|
private final IDeviceAlarmService deviceAlarmService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备告警列表
|
* 查询设备告警列表
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import com.fuyuanshen.common.log.annotation.Log;
|
||||||
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
|
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||||
|
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceChargeDischargeVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceChargeDischargeBo;
|
||||||
|
import com.fuyuanshen.equipment.service.IDeviceChargeDischargeService;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/equipment/chargeDischarge")
|
||||||
|
public class DeviceChargeDischargeController extends BaseController {
|
||||||
|
|
||||||
|
private final IDeviceChargeDischargeService deviceChargeDischargeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备充放电记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<DeviceChargeDischargeVo> list(DeviceChargeDischargeBo bo, PageQuery pageQuery) {
|
||||||
|
return deviceChargeDischargeService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:export")
|
||||||
|
@Log(title = "设备充放电记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(DeviceChargeDischargeBo bo, HttpServletResponse response) {
|
||||||
|
List<DeviceChargeDischargeVo> list = deviceChargeDischargeService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "设备充放电记录", DeviceChargeDischargeVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备充放电记录详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DeviceChargeDischargeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(deviceChargeDischargeService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备充放电记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:add")
|
||||||
|
@Log(title = "设备充放电记录", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceChargeDischargeBo bo) {
|
||||||
|
return toAjax(deviceChargeDischargeService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备充放电记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("equipment:chargeDischarge:edit")
|
||||||
|
@Log(title = "设备充放电记录", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceChargeDischargeBo bo) {
|
||||||
|
return toAjax(deviceChargeDischargeService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备充放电记录
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@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));
|
||||||
|
}
|
||||||
|
}
|
@ -4,16 +4,16 @@ import com.fuyuanshen.app.domain.dto.APPReNameDTO;
|
|||||||
import com.fuyuanshen.app.domain.dto.AppRealTimeStatusDto;
|
import com.fuyuanshen.app.domain.dto.AppRealTimeStatusDto;
|
||||||
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
|
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
|
||||||
import com.fuyuanshen.common.core.domain.R;
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.fuyuanshen.common.web.core.BaseController;
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||||
import com.fuyuanshen.equipment.domain.dto.InstructionRecordDto;
|
import com.fuyuanshen.equipment.domain.dto.InstructionRecordDto;
|
||||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
import com.fuyuanshen.equipment.domain.vo.*;
|
||||||
import com.fuyuanshen.equipment.domain.vo.InstructionRecordVo;
|
|
||||||
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
|
||||||
import com.fuyuanshen.web.service.device.DeviceBizService;
|
import com.fuyuanshen.web.service.device.DeviceBizService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -103,4 +103,48 @@ public class DeviceControlCenterController extends BaseController {
|
|||||||
return appDeviceService.getInstructionRecord(dto,pageQuery);
|
return appDeviceService.getInstructionRecord(dto,pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
*/
|
||||||
|
@GetMapping("/export")
|
||||||
|
public void export(InstructionRecordDto dto, PageQuery pageQuery, HttpServletResponse response) {
|
||||||
|
pageQuery.setPageNum(1);
|
||||||
|
pageQuery.setPageSize(2000);
|
||||||
|
TableDataInfo<InstructionRecordVo> instructionRecord = appDeviceService.getInstructionRecord(dto, pageQuery);
|
||||||
|
if(instructionRecord.getRows() == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExcelUtil.exportExcel(instructionRecord.getRows(), "设备操作日志", InstructionRecordVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史轨迹查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/locationHistory")
|
||||||
|
public TableDataInfo<LocationHistoryVo> getLocationHistory(InstructionRecordDto dto, PageQuery pageQuery) {
|
||||||
|
return appDeviceService.getLocationHistory(dto,pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史轨迹导出
|
||||||
|
*/
|
||||||
|
@GetMapping("/locationHistoryExport")
|
||||||
|
public void locationHistoryExport(InstructionRecordDto dto, PageQuery pageQuery, HttpServletResponse response) {
|
||||||
|
pageQuery.setPageNum(1);
|
||||||
|
pageQuery.setPageSize(2000);
|
||||||
|
TableDataInfo<LocationHistoryVo> result = appDeviceService.getLocationHistory(dto, pageQuery);
|
||||||
|
if(result.getRows() == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExcelUtil.exportExcel(result.getRows(), "历史轨迹记录", LocationHistoryVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史轨迹播放
|
||||||
|
*/
|
||||||
|
@GetMapping("/getLocationHistoryDetail")
|
||||||
|
public R<List<LocationHistoryDetailVo>> getLocationHistoryDetail(Long id) {
|
||||||
|
return R.ok(appDeviceService.getLocationHistoryDetail(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
package com.fuyuanshen.web.controller.device;
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import com.fuyuanshen.common.log.annotation.Log;
|
|
||||||
import com.fuyuanshen.common.web.core.BaseController;
|
|
||||||
import com.fuyuanshen.common.core.domain.R;
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
|
||||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import com.fuyuanshen.common.log.annotation.Log;
|
||||||
|
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||||
import com.fuyuanshen.equipment.service.IDeviceGroupService;
|
import com.fuyuanshen.equipment.service.IDeviceGroupService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备分组
|
* 设备分组
|
||||||
@ -51,6 +51,24 @@ public class DeviceGroupController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备分组列表(分页)
|
||||||
|
*/
|
||||||
|
@Operation(summary = "查询设备分组列表(分页)")
|
||||||
|
@SaCheckPermission("fys-equipment:group:list")
|
||||||
|
@GetMapping("/listPage")
|
||||||
|
public TableDataInfo<DeviceGroupVo> listPage(DeviceGroupBo bo) {
|
||||||
|
List<DeviceGroupVo> list = deviceGroupService.queryList(bo);
|
||||||
|
// return R.ok(list);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @GetMapping("/list")
|
||||||
|
// public TableDataInfo<DeviceAlarmVo> list(DeviceAlarmBo bo, PageQuery pageQuery) {
|
||||||
|
// return deviceAlarmService.queryPageList(bo, pageQuery);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出设备分组列表
|
* 导出设备分组列表
|
||||||
*/
|
*/
|
||||||
@ -110,7 +128,7 @@ public class DeviceGroupController extends BaseController {
|
|||||||
@SaCheckPermission("fys-equipment:group:remove")
|
@SaCheckPermission("fys-equipment:group:remove")
|
||||||
@Log(title = "设备分组", businessType = BusinessType.DELETE)
|
@Log(title = "设备分组", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
public R<Void> remove(@NotNull(message = "主键不能为空") @PathVariable Long[] ids) {
|
||||||
return toAjax(deviceGroupService.deleteWithValidByIds(List.of(ids), true));
|
return toAjax(deviceGroupService.deleteWithValidByIds(List.of(ids), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,11 +142,25 @@ public class DeviceGroupController extends BaseController {
|
|||||||
@Operation(summary = "绑定设备分组")
|
@Operation(summary = "绑定设备分组")
|
||||||
// @SaCheckPermission("fys-equipment:group:remove")
|
// @SaCheckPermission("fys-equipment:group:remove")
|
||||||
@Log(title = "绑定设备分组", businessType = BusinessType.DELETE)
|
@Log(title = "绑定设备分组", businessType = BusinessType.DELETE)
|
||||||
@GetMapping("/groupId/{deviceId}")
|
@GetMapping("/groupId/{groupId}/{deviceId}")
|
||||||
public R<Void> bindingDevice(@NotEmpty(message = "分组id 不能为空") @PathVariable Long groupId,
|
public R<Void> bindingDevice(@NotNull(message = "分组id 不能为空") @PathVariable Long groupId,
|
||||||
@NotEmpty(message = "设备id 不能为空") @PathVariable Long[] deviceId) {
|
@NotNull(message = "设备id 不能为空") @PathVariable Long[] deviceId) {
|
||||||
return toAjax(deviceGroupService.bindingDevice(groupId, deviceId));
|
return toAjax(deviceGroupService.bindingDevice(groupId, deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑设备分组
|
||||||
|
*
|
||||||
|
* @param deviceId 设备id
|
||||||
|
*/
|
||||||
|
@Operation(summary = "解绑设备分组")
|
||||||
|
// @SaCheckPermission("fys-equipment:group:remove")
|
||||||
|
@Log(title = "解绑设备分组", businessType = BusinessType.DELETE)
|
||||||
|
@GetMapping("/groupUnbind/{deviceId}")
|
||||||
|
public R<Void> groupUnbind(@NotNull(message = "设备id 不能为空") @PathVariable Long[] deviceId) {
|
||||||
|
return toAjax(deviceGroupService.groupUnbind(deviceId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,67 @@
|
|||||||
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DataOverviewVo;
|
||||||
|
import com.fuyuanshen.equipment.service.DeviceService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页数据
|
||||||
|
*
|
||||||
|
* @author: 默苍璃
|
||||||
|
* @date: 2025-09-0113:46
|
||||||
|
*/
|
||||||
|
@Tag(name = "首页数据", description = "首页数据")
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/device/homepage")
|
||||||
|
public class HomePageController {
|
||||||
|
|
||||||
|
private final DeviceService deviceService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 数据总览
|
||||||
|
* DataOverview
|
||||||
|
*/
|
||||||
|
@GetMapping("/getDataOverview")
|
||||||
|
public R<DataOverviewVo> getDataOverview() {
|
||||||
|
return R.ok(deviceService.getDataOverview());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 获取设备使用数据
|
||||||
|
@GetMapping("/{deviceId}")
|
||||||
|
public Map<String, Object> getUsageData(
|
||||||
|
@PathVariable String deviceId,
|
||||||
|
@RequestParam String range) {
|
||||||
|
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
|
||||||
|
if ("halfYear".equals(range)) {
|
||||||
|
response.put("months", Arrays.asList("1月", "2月", "3月", "4月", "5月", "6月"));
|
||||||
|
response.put("data", Arrays.asList(45, 52, 38, 60, 56, 48));
|
||||||
|
} else if ("oneYear".equals(range)) {
|
||||||
|
response.put("months", Arrays.asList("7月", "8月", "9月", "10月", "11月", "12月",
|
||||||
|
"1月", "2月", "3月", "4月", "5月", "6月"));
|
||||||
|
response.put("data", Arrays.asList(42, 38, 45, 48, 52, 55, 45, 52, 38, 60, 56, 48));
|
||||||
|
}
|
||||||
|
|
||||||
|
response.put("deviceId", deviceId);
|
||||||
|
response.put("range", range);
|
||||||
|
response.put("lastUpdate", new Date());
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
@ -53,7 +53,7 @@ public class WEBDeviceController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@Operation(summary = "设备详情")
|
@Operation(summary = "设备详情")
|
||||||
@GetMapping(value = "/pc/detail/{id}")
|
@GetMapping(value = "/pc/detail/{id}")
|
||||||
public R<WebDeviceVo> getDevice(@PathVariable Long id) {
|
public R<WebDeviceVo> getDeviceDetail(@PathVariable Long id) {
|
||||||
WebDeviceVo device = deviceService.getDevice(id);
|
WebDeviceVo device = deviceService.getDevice(id);
|
||||||
return R.ok(device);
|
return R.ok(device);
|
||||||
}
|
}
|
||||||
@ -101,7 +101,6 @@ public class WEBDeviceController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.fuyuanshen.web.service.device;
|
package com.fuyuanshen.web.service.device;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
@ -27,9 +28,7 @@ import com.fuyuanshen.equipment.domain.Device;
|
|||||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||||
import com.fuyuanshen.equipment.domain.dto.InstructionRecordDto;
|
import com.fuyuanshen.equipment.domain.dto.InstructionRecordDto;
|
||||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
import com.fuyuanshen.equipment.domain.vo.*;
|
||||||
import com.fuyuanshen.equipment.domain.vo.InstructionRecordVo;
|
|
||||||
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
|
||||||
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||||
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceLogMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceLogMapper;
|
||||||
@ -41,9 +40,8 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.time.*;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.fuyuanshen.common.core.constant.GlobalConstants.GLOBAL_REDIS_KEY;
|
import static com.fuyuanshen.common.core.constant.GlobalConstants.GLOBAL_REDIS_KEY;
|
||||||
import static com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants.*;
|
import static com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants.*;
|
||||||
@ -313,8 +311,8 @@ public class DeviceBizService {
|
|||||||
|
|
||||||
public Map<String, Object> getRealTimeStatus(AppRealTimeStatusDto statusDto) {
|
public Map<String, Object> getRealTimeStatus(AppRealTimeStatusDto statusDto) {
|
||||||
try {
|
try {
|
||||||
String commandType = statusDto.getTypeName()+"_" + statusDto.getFunctionMode();
|
// String commandType = statusDto.getTypeName()+"_" + statusDto.getFunctionMode();"FunctionAccessBatchStatusRule"
|
||||||
DeviceStatusRule rule = realTimeStatusEngine.getDeviceStatusRule(commandType);
|
DeviceStatusRule rule = realTimeStatusEngine.getDeviceStatusRule(statusDto.getTypeName());
|
||||||
if(rule == null){
|
if(rule == null){
|
||||||
throw new ServiceException("未匹配到处理命令");
|
throw new ServiceException("未匹配到处理命令");
|
||||||
}
|
}
|
||||||
@ -336,4 +334,63 @@ public class DeviceBizService {
|
|||||||
Page<InstructionRecordVo> result = deviceLogMapper.getInstructionRecord(pageQuery.build(), bo);
|
Page<InstructionRecordVo> result = deviceLogMapper.getInstructionRecord(pageQuery.build(), bo);
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TableDataInfo<LocationHistoryVo> getLocationHistory(InstructionRecordDto bo, PageQuery pageQuery) {
|
||||||
|
Page<LocationHistoryVo> result = deviceMapper.getLocationHistory(pageQuery.build(), bo);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LocationHistoryDetailVo> getLocationHistoryDetail(Long id) {
|
||||||
|
Device device = deviceMapper.selectById(id);
|
||||||
|
if (device == null) {
|
||||||
|
throw new ServiceException("设备不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算七天前的凌晨时间戳
|
||||||
|
LocalDateTime sevenDaysAgo = LocalDateTime.of(LocalDate.now().minusDays(7), LocalTime.MIDNIGHT);
|
||||||
|
long startTime = sevenDaysAgo.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
|
||||||
|
// 计算今天的凌晨时间戳
|
||||||
|
LocalDateTime today = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
|
||||||
|
long endTime = today.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
|
||||||
|
String deviceImei = device.getDeviceImei();
|
||||||
|
String a = GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ deviceImei + DEVICE_LOCATION_KEY_PREFIX + ":history";
|
||||||
|
Collection<String> list = RedisUtils.zRangeByScore(a, startTime, endTime);
|
||||||
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, List<JSONObject>> map = new LinkedHashMap<>();
|
||||||
|
for (String obj : list){
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(obj);
|
||||||
|
Long timestamp = jsonObject.getLong("timestamp");
|
||||||
|
LocalDate date = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault()).toLocalDate();
|
||||||
|
if (map.containsKey(date.toString())) {
|
||||||
|
map.get(date.toString()).add(jsonObject);
|
||||||
|
} else {
|
||||||
|
ArrayList<JSONObject> jsonList = new ArrayList<>();
|
||||||
|
jsonList.add(jsonObject);
|
||||||
|
map.put(date.toString(), jsonList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<LocationHistoryDetailVo> result = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, List<JSONObject>> entry : map.entrySet()) {
|
||||||
|
LocationHistoryDetailVo detailVo = new LocationHistoryDetailVo();
|
||||||
|
detailVo.setDate(entry.getKey());
|
||||||
|
detailVo.setDeviceName(device.getDeviceName());
|
||||||
|
detailVo.setStartLocation(entry.getValue().get(0).getString("address"));
|
||||||
|
detailVo.setEndLocation(entry.getValue().get(entry.getValue().size()-1).getString("address"));
|
||||||
|
String jsonString = JSONArray.toJSONString(entry.getValue());
|
||||||
|
List<Object> strings = JSONArray.parseArray(jsonString);
|
||||||
|
detailVo.setDetailList(strings);
|
||||||
|
result.add(detailVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import static com.fuyuanshen.common.core.constant.GlobalConstants.FUNCTION_ACCES
|
|||||||
public class FunctionAccessBatchStatusRule implements DeviceStatusRule {
|
public class FunctionAccessBatchStatusRule implements DeviceStatusRule {
|
||||||
@Override
|
@Override
|
||||||
public String getCommandType() {
|
public String getCommandType() {
|
||||||
return DeviceTypeConstants.TYPE_BJQ6170+"_2";
|
return "FunctionAccessBatchStatusRule";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,7 +21,7 @@ import static com.fuyuanshen.common.core.constant.GlobalConstants.FUNCTION_ACCES
|
|||||||
public class FunctionAccessStatusRule implements DeviceStatusRule {
|
public class FunctionAccessStatusRule implements DeviceStatusRule {
|
||||||
@Override
|
@Override
|
||||||
public String getCommandType() {
|
public String getCommandType() {
|
||||||
return DeviceTypeConstants.TYPE_BJQ6170+"_1";
|
return "FunctionAccessStatusRule";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,6 +11,7 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -373,6 +374,28 @@ public class RedisUtils {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据时间范围查询Sorted Set中的元素(重载方法,适用于时间戳查询)
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
* @param startTime 开始时间戳
|
||||||
|
* @param endTime 结束时间戳
|
||||||
|
* @return 指定时间范围内的元素集合
|
||||||
|
*/
|
||||||
|
public static Collection<String> zRangeByScore(String key, Long startTime, Long endTime) {
|
||||||
|
try {
|
||||||
|
RScoredSortedSet<String> sortedSet = CLIENT.getScoredSortedSet(key);
|
||||||
|
return sortedSet.valueRange(startTime, true, endTime, true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 记录错误日志(如果项目中有日志工具的话)
|
||||||
|
// log.error("根据时间范围查询Sorted Set中的元素失败: key={}, startTime={}, endTime={}, error={}",
|
||||||
|
// key, startTime, endTime, e.getMessage(), e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 追加缓存Set数据
|
* 追加缓存Set数据
|
||||||
*
|
*
|
||||||
@ -614,4 +637,73 @@ public class RedisUtils {
|
|||||||
RKeys rKeys = CLIENT.getKeys();
|
RKeys rKeys = CLIENT.getKeys();
|
||||||
return rKeys.countExists(key) > 0;
|
return rKeys.countExists(key) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向去重阻塞队列中添加元素
|
||||||
|
*
|
||||||
|
* @param queueKey 队列键
|
||||||
|
* @param dedupKey 去重集合键
|
||||||
|
* @param value 消息值
|
||||||
|
* @param timeout 过期时间
|
||||||
|
* @return 是否添加成功
|
||||||
|
*/
|
||||||
|
public static boolean offerDeduplicated(String queueKey, String dedupKey, String value, Duration timeout) {
|
||||||
|
// String jsonValue = value instanceof String ? (String) value : JsonUtils.toJsonString(value);
|
||||||
|
|
||||||
|
RLock lock = CLIENT.getLock("lock:" + queueKey);
|
||||||
|
try {
|
||||||
|
lock.lock();
|
||||||
|
|
||||||
|
RSet<String> dedupSet = CLIENT.getSet(dedupKey);
|
||||||
|
if (dedupSet.contains(value)) {
|
||||||
|
return false; // 元素已存在,不重复添加
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加到去重集合
|
||||||
|
dedupSet.add(value);
|
||||||
|
|
||||||
|
// 添加到阻塞队列
|
||||||
|
RBlockingQueue<String> queue = CLIENT.getBlockingQueue(queueKey);
|
||||||
|
boolean offered = queue.offer(value);
|
||||||
|
|
||||||
|
// 设置过期时间
|
||||||
|
if (timeout != null) {
|
||||||
|
queue.expire(timeout);
|
||||||
|
dedupSet.expire(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
return offered;
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从去重阻塞队列中消费元素
|
||||||
|
*
|
||||||
|
* @param queueKey 队列键
|
||||||
|
* @param dedupKey 去重集合键
|
||||||
|
* @param timeout 超时时间
|
||||||
|
* @param timeUnit 时间单位
|
||||||
|
* @return 消息值
|
||||||
|
*/
|
||||||
|
public static String pollDeduplicated(String queueKey, String dedupKey, long timeout, TimeUnit timeUnit) {
|
||||||
|
try {
|
||||||
|
RBlockingQueue<String> queue = CLIENT.getBlockingQueue(queueKey);
|
||||||
|
String value = queue.poll(timeout, timeUnit);
|
||||||
|
|
||||||
|
// 从去重集合中移除
|
||||||
|
if (value != null) {
|
||||||
|
RSet<String> dedupSet = CLIENT.getSet(dedupKey);
|
||||||
|
dedupSet.remove(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,13 @@ public class Device extends TenantEntity {
|
|||||||
@Schema(title = "ID")
|
@Schema(title = "ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(title = "设备ID")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
@Schema(title = "设备记录ID")
|
@Schema(title = "设备记录ID")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long assignId;
|
private Long assignId;
|
||||||
@ -153,6 +160,7 @@ public class Device extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
@Schema(title = "出厂日期")
|
@Schema(title = "出厂日期")
|
||||||
private Date productionDate;
|
private Date productionDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在线状态(0离线,1在线)
|
* 在线状态(0离线,1在线)
|
||||||
*/
|
*/
|
||||||
|
@ -88,7 +88,7 @@ public class DeviceAlarm extends TenantEntity {
|
|||||||
/**
|
/**
|
||||||
* 报警持续时间
|
* 报警持续时间
|
||||||
*/
|
*/
|
||||||
private Date durationTime;
|
private Long durationTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0已处理,1未处理
|
* 0已处理,1未处理
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录对象 device_charge_discharge
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_charge_discharge")
|
||||||
|
public class DeviceChargeDischarge extends TenantEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录唯一标识
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备唯一标识
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型: 0 charge-充电, 1 discharge-放电
|
||||||
|
*/
|
||||||
|
private Long operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
private Long initialSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
private Long finalSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充放电量(kWh)
|
||||||
|
*/
|
||||||
|
private Long energyKwh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备额定功率(kW)
|
||||||
|
*/
|
||||||
|
private Long powerRating;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压(V)
|
||||||
|
*/
|
||||||
|
private Long voltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电流(A)
|
||||||
|
*/
|
||||||
|
private Long current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度(℃)
|
||||||
|
*/
|
||||||
|
private Long temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态
|
||||||
|
*/
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误代码
|
||||||
|
*/
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录创建时间
|
||||||
|
*/
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录更新时间
|
||||||
|
*/
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -24,7 +24,7 @@ public class DeviceAlarmBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* ID
|
* ID
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
@NotNull(message = "ID不能为空", groups = {EditGroup.class})
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,14 +34,27 @@ public class DeviceAlarmBo extends BaseEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 报警事项
|
* 报警事项
|
||||||
|
* device_action
|
||||||
*/
|
*/
|
||||||
private String deviceAction;
|
private Integer deviceAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
*/
|
*/
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
* device_mac
|
||||||
|
*/
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备IMEI
|
||||||
|
* device_imei
|
||||||
|
*/
|
||||||
|
private String deviceImei;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据来源
|
* 数据来源
|
||||||
*/
|
*/
|
||||||
@ -54,12 +67,12 @@ public class DeviceAlarmBo extends BaseEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备类型
|
* 设备类型
|
||||||
|
* device_type
|
||||||
*/
|
*/
|
||||||
private Long deviceType;
|
private Long deviceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 经度
|
* 经度
|
||||||
|
|
||||||
*/
|
*/
|
||||||
private Long longitude;
|
private Long longitude;
|
||||||
|
|
||||||
@ -86,12 +99,18 @@ public class DeviceAlarmBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 报警持续时间
|
* 报警持续时间
|
||||||
*/
|
*/
|
||||||
private Date durationTime;
|
private Long durationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警查询时间
|
||||||
|
*/
|
||||||
|
private String queryTime1;
|
||||||
|
private String queryTime2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0已处理,1未处理
|
* 0已处理,1未处理
|
||||||
*/
|
*/
|
||||||
private Long treatmentState;
|
private Integer treatmentState;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,110 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.bo;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||||
|
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||||
|
import com.fuyuanshen.equipment.domain.DeviceChargeDischarge;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录业务对象 device_charge_discharge
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = DeviceChargeDischarge.class, reverseConvertGenerate = false)
|
||||||
|
public class DeviceChargeDischargeBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录唯一标识
|
||||||
|
*/
|
||||||
|
@NotNull(message = "记录唯一标识不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备唯一标识
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "设备唯一标识不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型: 0 charge-充电, 1 discharge-放电
|
||||||
|
*/
|
||||||
|
@NotNull(message = "操作类型: 0 charge-充电, 1 discharge-放电不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Long operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "开始时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
private Long initialSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
private Long finalSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充放电量(kWh)
|
||||||
|
*/
|
||||||
|
private Long energyKwh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备额定功率(kW)
|
||||||
|
*/
|
||||||
|
private Long powerRating;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压(V)
|
||||||
|
*/
|
||||||
|
private Long voltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电流(A)
|
||||||
|
*/
|
||||||
|
private Long current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度(℃)
|
||||||
|
*/
|
||||||
|
private Long temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态
|
||||||
|
*/
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误代码
|
||||||
|
*/
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录创建时间
|
||||||
|
*/
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录更新时间
|
||||||
|
*/
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -20,6 +20,12 @@ public class InstructionRecordDto {
|
|||||||
* 设备IMEI
|
* 设备IMEI
|
||||||
*/
|
*/
|
||||||
private String deviceImei;
|
private String deviceImei;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* content
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作时间-开始时间
|
* 操作时间-开始时间
|
||||||
*/
|
*/
|
||||||
@ -29,4 +35,9 @@ public class InstructionRecordDto {
|
|||||||
* 操作时间-结束时间
|
* 操作时间-结束时间
|
||||||
*/
|
*/
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组id
|
||||||
|
*/
|
||||||
|
private Long groupId;
|
||||||
}
|
}
|
||||||
|
@ -101,16 +101,16 @@ public class DeviceQueryCriteria extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Boolean isAdmin = false;
|
private Boolean isAdmin = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备所属分组
|
* 设备所属分组
|
||||||
*/
|
*/
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备地区
|
* 设备地区
|
||||||
*/
|
*/
|
||||||
private String area;
|
private String area;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警信息
|
||||||
|
*
|
||||||
|
* @author: 默苍璃
|
||||||
|
* @date: 2025-09-0114:24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AlarmInformationVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警总数
|
||||||
|
*/
|
||||||
|
private Integer alarmsTotal = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总处理报警
|
||||||
|
*/
|
||||||
|
private Integer processingAlarm = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制报警
|
||||||
|
*/
|
||||||
|
private Integer alarmForced = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撞击闯入
|
||||||
|
*/
|
||||||
|
private Integer intrusionImpact = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动报警
|
||||||
|
*/
|
||||||
|
private Integer alarmManual = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏
|
||||||
|
*/
|
||||||
|
private Integer fenceElectronic = 0;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据总览
|
||||||
|
*
|
||||||
|
* @author: 默苍璃
|
||||||
|
* @date: 2025-09-0114:24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DataOverviewVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备数据量
|
||||||
|
*/
|
||||||
|
private Integer devicesNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线设备
|
||||||
|
*/
|
||||||
|
private Integer equipmentOnline = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增绑定设备
|
||||||
|
*/
|
||||||
|
private Integer bindingNew = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常设备
|
||||||
|
*/
|
||||||
|
private Integer equipmentAbnormal = 0;
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ import cn.idev.excel.annotation.ExcelProperty;
|
|||||||
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||||
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@ -44,9 +45,10 @@ public class DeviceAlarmVo implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 报警事项
|
* 报警事项
|
||||||
|
* 0-强制报警,1-撞击闯入,2-手动报警,3-电子围栏告警,4-强制告警
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "报警事项")
|
@ExcelProperty(value = "报警事项")
|
||||||
private String deviceAction;
|
private Integer deviceAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
@ -54,6 +56,16 @@ public class DeviceAlarmVo implements Serializable {
|
|||||||
@ExcelProperty(value = "设备名称")
|
@ExcelProperty(value = "设备名称")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
*/
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备IMEI
|
||||||
|
*/
|
||||||
|
private String deviceImei;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据来源
|
* 数据来源
|
||||||
*/
|
*/
|
||||||
@ -71,6 +83,7 @@ public class DeviceAlarmVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "设备类型")
|
@ExcelProperty(value = "设备类型")
|
||||||
private Long deviceType;
|
private Long deviceType;
|
||||||
|
private String deviceTypeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 经度
|
* 经度
|
||||||
@ -106,13 +119,19 @@ public class DeviceAlarmVo implements Serializable {
|
|||||||
* 报警持续时间
|
* 报警持续时间
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "报警持续时间")
|
@ExcelProperty(value = "报警持续时间")
|
||||||
private Date durationTime;
|
private String durationTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0已处理,1未处理
|
* 0已处理,1未处理
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "0已处理,1未处理")
|
@ExcelProperty(value = "0已处理,1未处理")
|
||||||
private Long treatmentState;
|
private Integer treatmentState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备图片
|
||||||
|
* device_pic
|
||||||
|
*/
|
||||||
|
@Schema(name = "设备图片")
|
||||||
|
private String devicePic;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,130 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fuyuanshen.equipment.domain.DeviceChargeDischarge;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录视图对象 device_charge_discharge
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = DeviceChargeDischarge.class)
|
||||||
|
public class DeviceChargeDischargeVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录唯一标识
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录唯一标识")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备唯一标识
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备唯一标识")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型: 0 charge-充电, 1 discharge-放电
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "操作类型: 0 charge-充电, 1 discharge-放电")
|
||||||
|
private Long operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "开始时间")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "结束时间")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "起始电量百分比(0-100)")
|
||||||
|
private Long initialSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束电量百分比(0-100)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "结束电量百分比(0-100)")
|
||||||
|
private Long finalSoc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充放电量(kWh)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "充放电量(kWh)")
|
||||||
|
private Long energyKwh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备额定功率(kW)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备额定功率(kW)")
|
||||||
|
private Long powerRating;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压(V)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "电压(V)")
|
||||||
|
private Long voltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电流(A)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "电流(A)")
|
||||||
|
private Long current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度(℃)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "温度(℃)")
|
||||||
|
private Long temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "当前状态")
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误代码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "错误代码")
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录创建时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录创建时间")
|
||||||
|
private Date createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录更新时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录更新时间")
|
||||||
|
private Date updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备分类
|
||||||
|
*
|
||||||
|
* @author: 默苍璃
|
||||||
|
* @date: 2025-09-0114:24
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EquipmentClassificationVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4G设备
|
||||||
|
*/
|
||||||
|
private Integer equipment4G = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 蓝牙设备
|
||||||
|
*/
|
||||||
|
private Integer deviceBluetooth = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4G & 蓝牙 设备
|
||||||
|
*/
|
||||||
|
private Integer devices4GAndBluetooth = 0;
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.fuyuanshen.equipment.domain.vo;
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -8,25 +9,31 @@ public class InstructionRecordVo {
|
|||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ExcelProperty(value = "设备名称")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备类型
|
* 设备类型
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "设备型号")
|
||||||
private String deviceType;
|
private String deviceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作模块
|
* 操作模块
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "操作模块")
|
||||||
private String deviceAction;
|
private String deviceAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作内容
|
* 操作内容
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "操作内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作时间
|
* 操作时间
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty(value = "操作时间")
|
||||||
private String createTime;
|
private String createTime;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LocationHistoryDetailVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "日期")
|
||||||
|
private String date;
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始地点
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "初始地点")
|
||||||
|
private String startLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束地点
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "结束地点")
|
||||||
|
private String endLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轨迹详情
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "轨迹详情")
|
||||||
|
private List<Object> detailList;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LocationHistoryVo {
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ExcelProperty(value = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型
|
||||||
|
*/
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备型号")
|
||||||
|
private String deviceTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备IMEI
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备IMEI")
|
||||||
|
private String deviceImei;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备MAC
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备MAC")
|
||||||
|
private String deviceMac;
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.fuyuanshen.equipment.domain.vo;
|
package com.fuyuanshen.equipment.domain.vo;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package com.fuyuanshen.equipment.mapper;
|
package com.fuyuanshen.equipment.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
import com.fuyuanshen.equipment.domain.DeviceAlarm;
|
import com.fuyuanshen.equipment.domain.DeviceAlarm;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceAlarmBo;
|
||||||
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
import com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo;
|
||||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备告警Mapper接口
|
* 设备告警Mapper接口
|
||||||
@ -12,4 +16,13 @@ import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
|||||||
*/
|
*/
|
||||||
public interface DeviceAlarmMapper extends BaseMapperPlus<DeviceAlarm, DeviceAlarmVo> {
|
public interface DeviceAlarmMapper extends BaseMapperPlus<DeviceAlarm, DeviceAlarmVo> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备告警列表
|
||||||
|
*
|
||||||
|
* @param bo 设备告警
|
||||||
|
* @return 设备告警
|
||||||
|
*/
|
||||||
|
Page<DeviceAlarmVo> selectVoPage( Page pageQuery,@Param("bo") DeviceAlarmBo bo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.fuyuanshen.equipment.mapper;
|
||||||
|
|
||||||
|
import com.fuyuanshen.equipment.domain.DeviceChargeDischarge;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceChargeDischargeVo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
public interface DeviceChargeDischargeMapper extends BaseMapperPlus<DeviceChargeDischarge, DeviceChargeDischargeVo> {
|
||||||
|
|
||||||
|
}
|
@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuyuanshen.equipment.domain.Device;
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
|
import com.fuyuanshen.equipment.domain.dto.InstructionRecordDto;
|
||||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.LocationHistoryVo;
|
||||||
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -71,4 +73,6 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
|||||||
AppDeviceVo getDeviceInfo(@Param("deviceMac") String deviceMac);
|
AppDeviceVo getDeviceInfo(@Param("deviceMac") String deviceMac);
|
||||||
|
|
||||||
Page<WebDeviceVo> queryWebDeviceList(Page<Object> build,@Param("criteria") DeviceQueryCriteria criteria);
|
Page<WebDeviceVo> queryWebDeviceList(Page<Object> build,@Param("criteria") DeviceQueryCriteria criteria);
|
||||||
|
|
||||||
|
Page<LocationHistoryVo> getLocationHistory(Page<Object> build, @Param("bo") InstructionRecordDto criteria);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
|||||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||||
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DataOverviewVo;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -115,4 +116,10 @@ public interface DeviceService extends IService<Device> {
|
|||||||
*/
|
*/
|
||||||
int webUnBindDevice(Long id);
|
int webUnBindDevice(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据总览
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DataOverviewVo getDataOverview();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.fuyuanshen.equipment.service;
|
||||||
|
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceChargeDischargeVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceChargeDischargeBo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
public interface IDeviceChargeDischargeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备充放电记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备充放电记录
|
||||||
|
*/
|
||||||
|
DeviceChargeDischargeVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备充放电记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备充放电记录分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<DeviceChargeDischargeVo> queryPageList(DeviceChargeDischargeBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备充放电记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备充放电记录列表
|
||||||
|
*/
|
||||||
|
List<DeviceChargeDischargeVo> queryList(DeviceChargeDischargeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备充放电记录
|
||||||
|
*
|
||||||
|
* @param bo 设备充放电记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(DeviceChargeDischargeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备充放电记录
|
||||||
|
*
|
||||||
|
* @param bo 设备充放电记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(DeviceChargeDischargeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备充放电记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
@ -66,5 +66,13 @@ public interface IDeviceGroupService {
|
|||||||
* @param deviceId 设备id
|
* @param deviceId 设备id
|
||||||
* @return 是否绑定成功
|
* @return 是否绑定成功
|
||||||
*/
|
*/
|
||||||
Boolean bindingDevice(@NotEmpty(message = "分组id 不能为空") Long groupId, @NotEmpty(message = "设备id 不能为空") Long[] deviceId);
|
Boolean bindingDevice(Long groupId, Long[] deviceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑设备分组
|
||||||
|
*
|
||||||
|
* @param deviceId 设备id
|
||||||
|
* @return 是否解绑成功
|
||||||
|
*/
|
||||||
|
Boolean groupUnbind( Long[] deviceId);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
|
|
||||||
private final DeviceAlarmMapper baseMapper;
|
private final DeviceAlarmMapper baseMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备告警
|
* 查询设备告警
|
||||||
*
|
*
|
||||||
@ -40,10 +41,11 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
* @return 设备告警
|
* @return 设备告警
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DeviceAlarmVo queryById(Long id){
|
public DeviceAlarmVo queryById(Long id) {
|
||||||
return baseMapper.selectVoById(id);
|
return baseMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询设备告警列表
|
* 分页查询设备告警列表
|
||||||
*
|
*
|
||||||
@ -53,11 +55,13 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery) {
|
public TableDataInfo<DeviceAlarmVo> queryPageList(DeviceAlarmBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<DeviceAlarm> lqw = buildQueryWrapper(bo);
|
// LambdaQueryWrapper<DeviceAlarm> lqw = buildQueryWrapper(bo);
|
||||||
Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
// Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
Page<DeviceAlarmVo> result = baseMapper.selectVoPage(pageQuery.build(), bo);
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询符合条件的设备告警列表
|
* 查询符合条件的设备告警列表
|
||||||
*
|
*
|
||||||
@ -75,7 +79,7 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
LambdaQueryWrapper<DeviceAlarm> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<DeviceAlarm> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.orderByAsc(DeviceAlarm::getId);
|
lqw.orderByAsc(DeviceAlarm::getId);
|
||||||
lqw.eq(bo.getDeviceId() != null, DeviceAlarm::getDeviceId, bo.getDeviceId());
|
lqw.eq(bo.getDeviceId() != null, DeviceAlarm::getDeviceId, bo.getDeviceId());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceAction()), DeviceAlarm::getDeviceAction, bo.getDeviceAction());
|
// lqw.eq(StringUtils.isNotBlank(bo.getDeviceAction()), DeviceAlarm::getDeviceAction, bo.getDeviceAction());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAlarm::getDeviceName, bo.getDeviceName());
|
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAlarm::getDeviceName, bo.getDeviceName());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), DeviceAlarm::getDataSource, bo.getDataSource());
|
lqw.eq(StringUtils.isNotBlank(bo.getDataSource()), DeviceAlarm::getDataSource, bo.getDataSource());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getContent()), DeviceAlarm::getContent, bo.getContent());
|
lqw.eq(StringUtils.isNotBlank(bo.getContent()), DeviceAlarm::getContent, bo.getContent());
|
||||||
@ -123,8 +127,8 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(DeviceAlarm entity){
|
private void validEntityBeforeSave(DeviceAlarm entity) {
|
||||||
//TODO 做一些数据校验,如唯一约束
|
// TODO 做一些数据校验,如唯一约束
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,8 +140,8 @@ public class DeviceAlarmServiceImpl implements IDeviceAlarmService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
if(isValid){
|
if (isValid) {
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
// TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,146 @@
|
|||||||
|
package com.fuyuanshen.equipment.service.impl;
|
||||||
|
|
||||||
|
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.fuyuanshen.equipment.domain.bo.DeviceChargeDischargeBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DeviceChargeDischargeVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.DeviceChargeDischarge;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceChargeDischargeMapper;
|
||||||
|
import com.fuyuanshen.equipment.service.IDeviceChargeDischargeService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充放电记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-08-30
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class DeviceChargeDischargeServiceImpl implements IDeviceChargeDischargeService {
|
||||||
|
|
||||||
|
private final DeviceChargeDischargeMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备充放电记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备充放电记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceChargeDischargeVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备充放电记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备充放电记录分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<DeviceChargeDischargeVo> queryPageList(DeviceChargeDischargeBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<DeviceChargeDischarge> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<DeviceChargeDischargeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备充放电记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备充放电记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DeviceChargeDischargeVo> queryList(DeviceChargeDischargeBo bo) {
|
||||||
|
LambdaQueryWrapper<DeviceChargeDischarge> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<DeviceChargeDischarge> buildQueryWrapper(DeviceChargeDischargeBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<DeviceChargeDischarge> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(DeviceChargeDischarge::getId);
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDeviceId()), DeviceChargeDischarge::getDeviceId, bo.getDeviceId());
|
||||||
|
lqw.eq(bo.getOperationType() != null, DeviceChargeDischarge::getOperationType, bo.getOperationType());
|
||||||
|
lqw.eq(bo.getStartTime() != null, DeviceChargeDischarge::getStartTime, bo.getStartTime());
|
||||||
|
lqw.eq(bo.getEndTime() != null, DeviceChargeDischarge::getEndTime, bo.getEndTime());
|
||||||
|
lqw.eq(bo.getInitialSoc() != null, DeviceChargeDischarge::getInitialSoc, bo.getInitialSoc());
|
||||||
|
lqw.eq(bo.getFinalSoc() != null, DeviceChargeDischarge::getFinalSoc, bo.getFinalSoc());
|
||||||
|
lqw.eq(bo.getEnergyKwh() != null, DeviceChargeDischarge::getEnergyKwh, bo.getEnergyKwh());
|
||||||
|
lqw.eq(bo.getPowerRating() != null, DeviceChargeDischarge::getPowerRating, bo.getPowerRating());
|
||||||
|
lqw.eq(bo.getVoltage() != null, DeviceChargeDischarge::getVoltage, bo.getVoltage());
|
||||||
|
lqw.eq(bo.getCurrent() != null, DeviceChargeDischarge::getCurrent, bo.getCurrent());
|
||||||
|
lqw.eq(bo.getTemperature() != null, DeviceChargeDischarge::getTemperature, bo.getTemperature());
|
||||||
|
lqw.eq(bo.getStatus() != null, DeviceChargeDischarge::getStatus, bo.getStatus());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getErrorCode()), DeviceChargeDischarge::getErrorCode, bo.getErrorCode());
|
||||||
|
lqw.eq(bo.getCreatedAt() != null, DeviceChargeDischarge::getCreatedAt, bo.getCreatedAt());
|
||||||
|
lqw.eq(bo.getUpdatedAt() != null, DeviceChargeDischarge::getUpdatedAt, bo.getUpdatedAt());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备充放电记录
|
||||||
|
*
|
||||||
|
* @param bo 设备充放电记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(DeviceChargeDischargeBo bo) {
|
||||||
|
DeviceChargeDischarge add = MapstructUtils.convert(bo, DeviceChargeDischarge.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备充放电记录
|
||||||
|
*
|
||||||
|
* @param bo 设备充放电记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(DeviceChargeDischargeBo bo) {
|
||||||
|
DeviceChargeDischarge update = MapstructUtils.convert(bo, DeviceChargeDischarge.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(DeviceChargeDischarge entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备充放电记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -92,6 +92,7 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
|||||||
vo.setId(group.getId());
|
vo.setId(group.getId());
|
||||||
vo.setGroupName(group.getGroupName());
|
vo.setGroupName(group.getGroupName());
|
||||||
vo.setStatus(group.getStatus() == 1 ? "正常" : "禁用");
|
vo.setStatus(group.getStatus() == 1 ? "正常" : "禁用");
|
||||||
|
vo.setParentId(group.getParentId());
|
||||||
vo.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(group.getCreateTime()));
|
vo.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(group.getCreateTime()));
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
@ -124,10 +125,12 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
|||||||
throw new RuntimeException("分组名称已存在,请勿重复添加!!!");
|
throw new RuntimeException("分组名称已存在,请勿重复添加!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证父分组是否存在(如果提供了parentId)
|
if (bo.getParentId() != null) {
|
||||||
DeviceGroup pDeviceGroup = baseMapper.selectById(bo.getParentId());
|
// 验证父分组是否存在(如果提供了parentId)
|
||||||
if (bo.getParentId() != null && pDeviceGroup == null) {
|
DeviceGroup pDeviceGroup = baseMapper.selectById(bo.getParentId());
|
||||||
throw new RuntimeException("父分组不存在!!!");
|
if (bo.getParentId() != null && pDeviceGroup == null) {
|
||||||
|
throw new RuntimeException("父分组不存在!!!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceGroup add = MapstructUtils.convert(bo, DeviceGroup.class);
|
DeviceGroup add = MapstructUtils.convert(bo, DeviceGroup.class);
|
||||||
@ -199,4 +202,27 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解绑设备分组
|
||||||
|
*
|
||||||
|
* @param deviceId 设备id
|
||||||
|
* @return 是否解绑成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean groupUnbind( Long[] deviceId) {
|
||||||
|
|
||||||
|
if (deviceId != null && deviceId.length > 0) {
|
||||||
|
// 创建更新条件
|
||||||
|
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.in("id", Arrays.asList(deviceId));
|
||||||
|
updateWrapper.set("group_id", null);
|
||||||
|
|
||||||
|
// 执行批量更新
|
||||||
|
deviceMapper.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
|||||||
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
|
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
|
||||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||||
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.DataOverviewVo;
|
||||||
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||||
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
||||||
import com.fuyuanshen.equipment.enums.DeviceActiveStatusEnum;
|
import com.fuyuanshen.equipment.enums.DeviceActiveStatusEnum;
|
||||||
@ -595,6 +596,8 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备MAC号
|
* 查询设备MAC号
|
||||||
*
|
*
|
||||||
@ -613,4 +616,14 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据总览
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DataOverviewVo getDataOverview() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -157,11 +157,11 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
|||||||
throw new RuntimeException("设备类型不存在");
|
throw new RuntimeException("设备类型不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>()
|
// List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>()
|
||||||
.eq("device_type", deviceTypeGrants.getDeviceTypeId()));
|
// .eq("device_type", deviceTypeGrants.getDeviceTypeId()));
|
||||||
if (CollectionUtil.isNotEmpty(devices)) {
|
// if (CollectionUtil.isNotEmpty(devices)) {
|
||||||
throw new RuntimeException("该设备类型已绑定设备,无法修改!!!");
|
// throw new RuntimeException("该设备类型已绑定设备,无法修改!!!");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 校验设备类型名称
|
// 校验设备类型名称
|
||||||
DeviceType dt = deviceTypeMapper.selectOne(new QueryWrapper<DeviceType>().eq("type_name", resources.getTypeName()));
|
DeviceType dt = deviceTypeMapper.selectOne(new QueryWrapper<DeviceType>().eq("type_name", resources.getTypeName()));
|
||||||
|
@ -1,7 +1,33 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.fuyuanshen.equipment.mapper.DeviceAlarmMapper">
|
<mapper namespace="com.fuyuanshen.equipment.mapper.DeviceAlarmMapper">
|
||||||
|
|
||||||
|
<!-- 查询设备告警列表 -->
|
||||||
|
<select id="selectVoPage" resultType="com.fuyuanshen.equipment.domain.vo.DeviceAlarmVo">
|
||||||
|
select *, d.device_mac as deviceMac, d.device_imei as deviceImei,
|
||||||
|
d.type_name as deviceTypeName, d.device_pic as devicePic
|
||||||
|
from device_alarm da
|
||||||
|
left join device d on da.device_id = d.id
|
||||||
|
left join device_type dt on dt.id = da.device_type
|
||||||
|
<where>
|
||||||
|
<if test="bo.deviceName != null">
|
||||||
|
and da.device_name = #{bo.deviceName}
|
||||||
|
</if>
|
||||||
|
<if test="bo.deviceType != null">
|
||||||
|
and da.device_type = #{bo.deviceType}
|
||||||
|
</if>
|
||||||
|
<if test="bo.deviceAction != null">
|
||||||
|
and da.device_action = #{bo.deviceAction}
|
||||||
|
</if>
|
||||||
|
<if test="bo.treatmentState != null">
|
||||||
|
and da.treatment_state = #{bo.treatmentState}
|
||||||
|
</if>
|
||||||
|
<if test="bo.queryTime1 != null and bo.queryTime2 != null ">
|
||||||
|
and da.start_time between #{bo.queryTime1} and #{bo.queryTime2}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.fuyuanshen.equipment.mapper.DeviceChargeDischargeMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -28,11 +28,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="bo.deviceImei != null and bo.deviceImei != ''">
|
<if test="bo.deviceImei != null and bo.deviceImei != ''">
|
||||||
AND b.device_imei = #{bo.deviceImei}
|
AND b.device_imei = #{bo.deviceImei}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="bo.content != null and bo.content != ''">
|
||||||
|
AND b.device_imei = #{bo.content} or b.device_mac = #{bo.content}
|
||||||
|
</if>
|
||||||
<if test="bo.startTime != null and bo.startTime != ''">
|
<if test="bo.startTime != null and bo.startTime != ''">
|
||||||
AND create_time <![CDATA[>=]]> #{bo.startTime}
|
AND a.create_time <![CDATA[>=]]> #{bo.startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="bo.endTime != null and bo.endTime != ''">
|
<if test="bo.endTime != null and bo.endTime != ''">
|
||||||
AND create_time <![CDATA[<=]]> #{bo.startTime}
|
AND a.create_time <![CDATA[<=]]> #{bo.endTime}
|
||||||
|
</if>
|
||||||
|
<if test="bo.groupId != null">
|
||||||
|
and b.group_id = #{bo.groupId}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
a.create_time DESC
|
a.create_time DESC
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
SELECT *
|
SELECT *
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
da.id AS id, d.device_name, d.bluetooth_name,
|
da.id AS id, d.id AS deviceId, d.device_name, d.bluetooth_name, d.group_id,
|
||||||
d.pub_topic, d.sub_topic, d.device_pic,
|
d.pub_topic, d.sub_topic, d.device_pic,
|
||||||
d.device_mac, d.device_sn, d.update_by,
|
d.device_mac, d.device_sn, d.update_by,
|
||||||
d.device_imei, d.update_time, dg.id AS device_type,
|
d.device_imei, d.update_time, dg.id AS device_type,
|
||||||
@ -71,6 +71,9 @@
|
|||||||
<if test="criteria.deviceStatus != null">
|
<if test="criteria.deviceStatus != null">
|
||||||
and da.active = #{criteria.deviceStatus}
|
and da.active = #{criteria.deviceStatus}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="criteria.groupId != null">
|
||||||
|
and d.group_id = #{criteria.groupId}
|
||||||
|
</if>
|
||||||
<if test="criteria.params.beginTime != null and criteria.params.endTime != null">
|
<if test="criteria.params.beginTime != null and criteria.params.endTime != null">
|
||||||
and da.create_time between #{criteria.params.beginTime} and #{criteria.params.endTime}
|
and da.create_time between #{criteria.params.beginTime} and #{criteria.params.endTime}
|
||||||
</if>
|
</if>
|
||||||
@ -257,11 +260,11 @@
|
|||||||
<if test="criteria.deviceName != null and criteria.deviceName != ''">
|
<if test="criteria.deviceName != null and criteria.deviceName != ''">
|
||||||
and d.device_name like concat('%', #{criteria.deviceName}, '%')
|
and d.device_name like concat('%', #{criteria.deviceName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="criteria.deviceMac != null">
|
<if test="criteria.deviceImei != null and criteria.deviceImei != ''">
|
||||||
and d.device_mac = #{criteria.deviceMac}
|
and (d.device_imei = #{criteria.deviceImei}
|
||||||
</if>
|
</if>
|
||||||
<if test="criteria.deviceImei != null">
|
<if test="criteria.content != null and criteria.content != ''">
|
||||||
and d.device_imei = #{criteria.deviceImei}
|
AND d.device_imei = #{criteria.content} or d.device_mac = #{criteria.content}
|
||||||
</if>
|
</if>
|
||||||
<if test="criteria.deviceStatus != null">
|
<if test="criteria.deviceStatus != null">
|
||||||
and d.device_status = #{criteria.deviceStatus}
|
and d.device_status = #{criteria.deviceStatus}
|
||||||
@ -276,5 +279,36 @@
|
|||||||
and d.group_id = #{criteria.groupId}
|
and d.group_id = #{criteria.groupId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getLocationHistory" resultType="com.fuyuanshen.equipment.domain.vo.LocationHistoryVo">
|
||||||
|
select a.id,a.device_name,a.device_type,b.type_name deviceTypeName,a.device_imei,a.device_mac from device a
|
||||||
|
inner join device_type b on a.device_type = b.id
|
||||||
|
|
||||||
|
<if test="bo.deviceType != null">
|
||||||
|
AND b.id = #{bo.deviceType}
|
||||||
|
</if>
|
||||||
|
<if test="bo.deviceName != null and bo.deviceName != ''">
|
||||||
|
AND a.device_name like concat('%',#{bo.deviceName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="bo.deviceMac != null and bo.deviceMac != ''">
|
||||||
|
AND a.device_mac = #{bo.deviceMac}
|
||||||
|
</if>
|
||||||
|
<if test="bo.deviceImei != null and bo.deviceImei != ''">
|
||||||
|
AND a.device_imei = #{bo.deviceImei}
|
||||||
|
</if>
|
||||||
|
<if test="bo.content != null and bo.content != ''">
|
||||||
|
AND a.device_imei = #{bo.content} or a.device_mac = #{bo.content}
|
||||||
|
</if>
|
||||||
|
<if test="bo.startTime != null and bo.startTime != ''">
|
||||||
|
AND a.create_time <![CDATA[>=]]> #{bo.startTime}
|
||||||
|
</if>
|
||||||
|
<if test="bo.endTime != null and bo.endTime != ''">
|
||||||
|
AND a.create_time <![CDATA[<=]]> #{bo.endTime}
|
||||||
|
</if>
|
||||||
|
<if test="bo.groupId != null">
|
||||||
|
and a.group_id = #{bo.groupId}
|
||||||
|
</if>
|
||||||
|
ORDER BY
|
||||||
|
a.create_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Reference in New Issue
Block a user