mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 01:48:47 +08:00
web端优化及统计新增
This commit is contained in:
parent
6582f477f4
commit
8e289b0f00
@ -23,7 +23,7 @@ import org.dromara.web.service.IEqEquipmentService;
|
|||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备信息
|
* web端设备信息
|
||||||
*
|
*
|
||||||
* @author zzc
|
* @author zzc
|
||||||
* @date 2024-08-08
|
* @date 2024-08-08
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.dromara.web.domain.vo.EqEquipmentStatisticsVo;
|
||||||
|
import org.dromara.web.service.IEqEquipmentService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@ -23,7 +25,7 @@ import org.dromara.web.service.IEqEquipmentLogService;
|
|||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备状态日志
|
* web端 统计分析
|
||||||
*
|
*
|
||||||
* @author zzc
|
* @author zzc
|
||||||
* @date 2024-08-14
|
* @date 2024-08-14
|
||||||
@ -35,6 +37,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
public class EqShowEquipmentLogController extends BaseController {
|
public class EqShowEquipmentLogController extends BaseController {
|
||||||
|
|
||||||
private final IEqEquipmentLogService eqEquipmentLogService;
|
private final IEqEquipmentLogService eqEquipmentLogService;
|
||||||
|
private final IEqEquipmentService eqEquipmentService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备状态日志列表
|
* 查询设备状态日志列表
|
||||||
@ -45,6 +48,19 @@ public class EqShowEquipmentLogController extends BaseController {
|
|||||||
return eqEquipmentLogService.queryPageList(bo, pageQuery);
|
return eqEquipmentLogService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型统计
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:showEquipmentLog:list")
|
||||||
|
@GetMapping("/statisticEquipmentList")
|
||||||
|
public R<EqEquipmentStatisticsVo> statisticEquipmentList(Integer type, String startTime, String endTime) {
|
||||||
|
return R.ok(eqEquipmentService.statisticEquipmentList(type,startTime,endTime));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* *//**
|
/* *//**
|
||||||
* 导出设备状态日志列表
|
* 导出设备状态日志列表
|
||||||
*//*
|
*//*
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import org.dromara.web.domain.bo.EqUserEquipmentBo;
|
|||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备信息
|
* web端 客户管理
|
||||||
*
|
*
|
||||||
* @author zzc
|
* @author zzc
|
||||||
* @date 2024-08-13
|
* @date 2024-08-13
|
||||||
@ -29,7 +29,7 @@ public class EqShowUserEquipmentController extends BaseController {
|
|||||||
private final IEqEquipmentService eqEquipmentService;
|
private final IEqEquipmentService eqEquipmentService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备信息列表
|
* 用户统计 查询设备信息列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<EqUserEquipmentVo> list(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
public TableDataInfo<EqUserEquipmentVo> list(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||||
|
|||||||
@ -0,0 +1,54 @@
|
|||||||
|
package org.dromara.web.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息视图对象 eq_user_equipment
|
||||||
|
*
|
||||||
|
* @author zzc
|
||||||
|
* @date 2024-08-13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class EqEquipmentStatisticsVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定设备(个)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "绑定设备(个)")
|
||||||
|
private Integer bindNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线设备(个)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "在线设备(个)")
|
||||||
|
private Integer onlineNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离线设备(个)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "离线设备(个)")
|
||||||
|
private Integer offlineNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障设备(个)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "故障设备(个)")
|
||||||
|
private Integer faultNum;
|
||||||
|
}
|
||||||
@ -2,7 +2,9 @@ package org.dromara.web.mapper;
|
|||||||
|
|
||||||
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 org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.web.domain.EqEquipment;
|
import org.dromara.web.domain.EqEquipment;
|
||||||
|
import org.dromara.web.domain.vo.EqEquipmentStatisticsVo;
|
||||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||||
@ -18,4 +20,11 @@ import java.util.List;
|
|||||||
public interface EqEquipmentMapper extends BaseMapperPlus<EqEquipment, EqEquipmentVo> {
|
public interface EqEquipmentMapper extends BaseMapperPlus<EqEquipment, EqEquipmentVo> {
|
||||||
|
|
||||||
IPage<EqUserEquipmentVo> selectEquipmentVoPage(Page<EqEquipment> page, String nickName);
|
IPage<EqUserEquipmentVo> selectEquipmentVoPage(Page<EqEquipment> page, String nickName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备类型 统计设备信息 统计 总数 离线 在线 和 故障状态个数
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EqEquipmentStatisticsVo selectStatisticEquipmentList(Integer type, String startTime, String endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,9 @@ package org.dromara.web.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.dromara.web.domain.bo.*;
|
import org.dromara.web.domain.bo.*;
|
||||||
import org.dromara.web.domain.vo.EqEquipmentDetailVo;
|
import org.dromara.web.domain.vo.*;
|
||||||
import org.dromara.web.domain.vo.EqEquipmentStatusVo;
|
|
||||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -95,5 +92,18 @@ public interface IEqEquipmentService {
|
|||||||
*/
|
*/
|
||||||
boolean updateByBos(List<EqAppHomeBo> bos);
|
boolean updateByBos(List<EqAppHomeBo> bos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户设备列表
|
||||||
|
* @param bo
|
||||||
|
* @param pageQuery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
IPage<EqUserEquipmentVo> queryEqUserEquipment(EqUserEquipmentBo bo, PageQuery pageQuery);
|
IPage<EqUserEquipmentVo> queryEqUserEquipment(EqUserEquipmentBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备统计
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EqEquipmentStatisticsVo statisticEquipmentList(Integer type, String startTime, String endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import org.dromara.web.device.iot.DeviceMsgDto;
|
|||||||
import org.dromara.web.device.iot.DeviceServerMsgDto;
|
import org.dromara.web.device.iot.DeviceServerMsgDto;
|
||||||
import org.dromara.web.domain.bo.*;
|
import org.dromara.web.domain.bo.*;
|
||||||
import org.dromara.web.domain.vo.EqEquipmentDetailVo;
|
import org.dromara.web.domain.vo.EqEquipmentDetailVo;
|
||||||
|
import org.dromara.web.domain.vo.EqEquipmentStatisticsVo;
|
||||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||||
import org.dromara.web.service.IotService;
|
import org.dromara.web.service.IotService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -283,8 +284,14 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
|||||||
public IPage<EqUserEquipmentVo> queryEqUserEquipment(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
public IPage<EqUserEquipmentVo> queryEqUserEquipment(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||||
Page<EqEquipment> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
Page<EqEquipment> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
||||||
// 调用Mapper中的新方法
|
// 调用Mapper中的新方法
|
||||||
IPage<EqUserEquipmentVo> voPage = baseMapper.selectEquipmentVoPage(page, bo.getNickName());
|
return baseMapper.selectEquipmentVoPage(page, bo.getNickName());
|
||||||
return voPage;
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EqEquipmentStatisticsVo statisticEquipmentList(Integer type, String startTime, String endTime) {
|
||||||
|
EqEquipmentStatisticsVo result = baseMapper.selectStatisticEquipmentList(type, startTime, endTime);
|
||||||
|
result.setType(type);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,9 +10,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
user_id,
|
user_id,
|
||||||
nick_name,
|
nick_name,
|
||||||
user_name,
|
user_name,
|
||||||
COUNT(*) AS bind_num,
|
COUNT(*) AS bind_num, -- 设备总数
|
||||||
SUM(line_status = 1) AS online_num,
|
SUM(CASE WHEN line_status = 0 THEN 1 ELSE 0 END) AS offline_num, -- 离线个数
|
||||||
SUM(line_status = 0) AS offline_num
|
SUM(CASE WHEN line_status = 1 THEN 1 ELSE 0 END) AS online_num, -- 在线个数
|
||||||
FROM eq_equipment
|
FROM eq_equipment
|
||||||
<where>
|
<where>
|
||||||
<if test="nickName != null and nickName != ''">
|
<if test="nickName != null and nickName != ''">
|
||||||
@ -22,4 +22,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
GROUP BY user_name, nick_name
|
GROUP BY user_name, nick_name
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectStatisticEquipmentList" resultType="org.dromara.web.domain.vo.EqEquipmentStatisticsVo">
|
||||||
|
SELECT
|
||||||
|
COUNT(*) AS bind_num, -- 设备总数
|
||||||
|
SUM(CASE WHEN line_status = 0 THEN 1 ELSE 0 END) AS offline_num, -- 离线个数
|
||||||
|
SUM(CASE WHEN line_status = 1 THEN 1 ELSE 0 END) AS online_num, -- 在线个数
|
||||||
|
SUM(CASE WHEN fault_status > 0 THEN 1 ELSE 0 END) AS fault_num -- 故障个数
|
||||||
|
FROM eq_equipment
|
||||||
|
<where>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
AND 'type' like
|
||||||
|
CONCAT('%', #{type}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
AND bind_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user