feat:新增iot物联设备统计接口
parent
67f714f080
commit
70627b54d3
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.device.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 物联设备状态统计 Resp VO")
|
||||||
|
@Data
|
||||||
|
public class DeviceStatusStatisticsRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "总数")
|
||||||
|
private Long totalCount;
|
||||||
|
|
||||||
|
@Schema(description = "运行数")
|
||||||
|
private Long runningCount;
|
||||||
|
|
||||||
|
@Schema(description = "待机数")
|
||||||
|
private Long standbyCount;
|
||||||
|
|
||||||
|
@Schema(description = "报警数")
|
||||||
|
private Long alarmCount;
|
||||||
|
|
||||||
|
@Schema(description = "离线数")
|
||||||
|
private Long offlineCount;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.api.deviceledger;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public interface DeviceLedgerApi {
|
||||||
|
|
||||||
|
Set<Long> getMaintenanceIotDeviceIds(Collection<Long> iotDeviceIds);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.api.deviceledger;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.deviceledger.enums.DeviceLedgerStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.deviceledger.DeviceLedgerDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.deviceledger.DeviceLedgerMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DeviceLedgerApiImpl implements DeviceLedgerApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeviceLedgerMapper deviceLedgerMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Long> getMaintenanceIotDeviceIds(Collection<Long> iotDeviceIds) {
|
||||||
|
if (CollUtil.isEmpty(iotDeviceIds)) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
return deviceLedgerMapper.selectList(Wrappers.<DeviceLedgerDO>lambdaQuery()
|
||||||
|
.select(DeviceLedgerDO::getDvId)
|
||||||
|
.in(DeviceLedgerDO::getDvId, iotDeviceIds)
|
||||||
|
.eq(DeviceLedgerDO::getDeviceStatus, DeviceLedgerStatusEnum.MAINTENANCE.getCode()))
|
||||||
|
.stream()
|
||||||
|
.map(DeviceLedgerDO::getDvId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue