소스 검색

数据大屏接口补充

zhengjie 1 년 전
부모
커밋
7e17b47b3e
17개의 변경된 파일317개의 추가작업 그리고 1개의 파일을 삭제
  1. 46 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDataDisplayController.java
  2. 32 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/AddDeviceDto.java
  3. 35 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/AddUserDto.java
  4. 66 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/AlarmStatusListDto.java
  5. 41 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/DeviceOverDto.java
  6. 15 1
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDeviceListMapper.java
  7. 8 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TShouhuanAlarmListMapper.java
  8. 8 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/TUserProfileMapper.java
  9. 14 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ITDeviceListService.java
  10. 8 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ITShouhuanAlarmListService.java
  11. 8 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ITUserProfileService.java
  12. 10 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeviceListServiceImpl.java
  13. 6 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TShouhuanAlarmListServiceImpl.java
  14. 6 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TUserProfileServiceImpl.java
  15. 6 0
      ruoyi-system/src/main/resources/mapper/system/TDeviceListMapper.xml
  16. 5 0
      ruoyi-system/src/main/resources/mapper/system/TShouhuanAlarmListMapper.xml
  17. 3 0
      ruoyi-system/src/main/resources/mapper/system/TUserProfileMapper.xml

+ 46 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDataDisplayController.java

@@ -165,6 +165,52 @@ public class TDataDisplayController extends BaseController
         return AjaxResult.success("操作成功",ajax);
     }
 
+    /**
+     * 用户新增
+     */
+    @GetMapping("/addUser")
+    public AjaxResult addUser()
+    {
+        List<AddUserDto> dtoList = userProfileService.selectAddUser();
+        return success(dtoList);
+    }
+
+    /**
+     * 设备新增
+     */
+    @GetMapping("/addDevice")
+    public AjaxResult addDevice()
+    {
+        List<AddDeviceDto> dtoList = tDeviceListService.selectAddDevice();
+        return success(dtoList);
+    }
+
+    /**
+     * 设备新增
+     */
+    @GetMapping("/alarmStatusList")
+    public AjaxResult alarmStatusList()
+    {
+        List<AlarmStatusListDto> dtoList = tShouhuanAlarmListService.selectAlarmStatusListDto();
+        for (AlarmStatusListDto dto : dtoList){
+            dto.setAlarm_msg(tDeviceListService.checkMessage(dto.getAlarm_type()));
+        }
+        return success(dtoList);
+    }
+
+    /**
+     * 设备总览
+     */
+    @GetMapping("/deviceOver")
+    public AjaxResult deviceOver()
+    {
+        DeviceOverDto dto = new DeviceOverDto();
+        dto.setBindDevice(tDeviceListService.selectDeviceListCount());
+        dto.setBindUser(tDeviceListService.selectTDeviceListBandUser());
+        dto.setDeviceOnline(tShouhuanAlarmListService.selectTShouhuanAlarmStatus());
+        return success(dto);
+    }
+
     /**
      * 查询SOS预警处理列表
      */

+ 32 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/AddDeviceDto.java

@@ -0,0 +1,32 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.common.annotation.Excel;
+
+public class AddDeviceDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 月份 */
+    @Excel(name = "月份")
+    private String month;
+
+    /** 数量 */
+    @Excel(name = "数量")
+    private Integer count;
+
+    public String getMonth() {
+        return month;
+    }
+
+    public void setMonth(String month) {
+        this.month = month;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}

+ 35 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/AddUserDto.java

@@ -0,0 +1,35 @@
+package com.ruoyi.system.domain.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+
+import java.util.Date;
+
+public class AddUserDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 月份 */
+    @Excel(name = "月份")
+    private String month;
+
+    /** 数量 */
+    @Excel(name = "数量")
+    private Integer count;
+
+    public String getMonth() {
+        return month;
+    }
+
+    public void setMonth(String month) {
+        this.month = month;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}

+ 66 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/AlarmStatusListDto.java

@@ -0,0 +1,66 @@
+package com.ruoyi.system.domain.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class AlarmStatusListDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 姓名 */
+    private String name;
+
+    /** ID */
+    private String device_id_code;
+
+    /** 时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createtime;
+
+    /** 类型 */
+    private Integer alarm_type;
+
+    /** 类型 */
+    private String alarm_msg;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDevice_id_code() {
+        return device_id_code;
+    }
+
+    public void setDevice_id_code(String device_id_code) {
+        this.device_id_code = device_id_code;
+    }
+
+    public Date getCreatetime() {
+        return createtime;
+    }
+
+    public void setCreatetime(Date createtime) {
+        this.createtime = createtime;
+    }
+
+    public Integer getAlarm_type() {
+        return alarm_type;
+    }
+
+    public void setAlarm_type(Integer alarm_type) {
+        this.alarm_type = alarm_type;
+    }
+
+    public String getAlarm_msg() {
+        return alarm_msg;
+    }
+
+    public void setAlarm_msg(String alarm_msg) {
+        this.alarm_msg = alarm_msg;
+    }
+}

+ 41 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/DeviceOverDto.java

@@ -0,0 +1,41 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.common.annotation.Excel;
+
+public class DeviceOverDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 绑定设备 */
+    private Integer bindDevice;
+
+    /** 绑定用户 */
+    private Integer bindUser;
+
+    /** 设备活跃数 */
+    private Integer deviceOnline;
+
+    public Integer getBindDevice() {
+        return bindDevice;
+    }
+
+    public void setBindDevice(Integer bindDevice) {
+        this.bindDevice = bindDevice;
+    }
+
+    public Integer getBindUser() {
+        return bindUser;
+    }
+
+    public void setBindUser(Integer bindUser) {
+        this.bindUser = bindUser;
+    }
+
+    public Integer getDeviceOnline() {
+        return deviceOnline;
+    }
+
+    public void setDeviceOnline(Integer deviceOnline) {
+        this.deviceOnline = deviceOnline;
+    }
+}

+ 15 - 1
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDeviceListMapper.java

@@ -202,9 +202,23 @@ public interface TDeviceListMapper
     public List<DeviceTypeDto> selectDeviceListDto();
 
     /**
-     * 最大心率
+     * 绑定设备
      *
      * @return 结果
      */
     public Integer selectDeviceListCount();
+
+    /**
+     * 查询设备绑定用户数
+     *
+     * @return 设备列集合
+     */
+    public Integer selectTDeviceListBandUser();
+
+    /**
+     * 设备新增
+     *
+     * @return 结果
+     */
+    public List<AddDeviceDto> selectAddDevice();
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TShouhuanAlarmListMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
 
 import java.util.List;
 import com.ruoyi.system.domain.TShouhuanAlarmList;
+import com.ruoyi.system.domain.dto.AlarmStatusListDto;
 import com.ruoyi.system.domain.dto.DataAlarmListDto;
 
 /**
@@ -165,4 +166,11 @@ public interface TShouhuanAlarmListMapper
      * @return 结果
      */
     public int selectTShouhuanAlarmOtherSolve();
+
+    /**
+     * 报警列表
+     *
+     * @return 结果
+     */
+    public List<AlarmStatusListDto> selectAlarmStatusListDto();
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TUserProfileMapper.java

@@ -7,6 +7,7 @@ import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TUserProfile;
 import com.ruoyi.system.domain.TEmergentPeople;
+import com.ruoyi.system.domain.dto.AddUserDto;
 import com.ruoyi.system.domain.dto.TUserProfileDto;
 import com.ruoyi.system.domain.dto.UserAgeDto;
 
@@ -120,4 +121,11 @@ public interface TUserProfileMapper
      * @return 结果
      */
     public Integer selectuserAgeCount();
+
+    /**
+     * 用户新增
+     *
+     * @return 结果
+     */
+    public List<AddUserDto> selectAddUser();
 }

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITDeviceListService.java

@@ -154,4 +154,18 @@ public interface ITDeviceListService
      * @return 结果
      */
     public Integer selectDeviceListCount();
+
+    /**
+     * 设备新增
+     *
+     * @return 结果
+     */
+    public List<AddDeviceDto> selectAddDevice();
+
+    /**
+     * 查询设备绑定用户数
+     *
+     * @return 设备列集合
+     */
+    public Integer selectTDeviceListBandUser();
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITShouhuanAlarmListService.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.service;
 
 import java.util.List;
 import com.ruoyi.system.domain.TShouhuanAlarmList;
+import com.ruoyi.system.domain.dto.AlarmStatusListDto;
 import com.ruoyi.system.domain.dto.DataAlarmListDto;
 
 /**
@@ -166,4 +167,11 @@ public interface ITShouhuanAlarmListService
      * @return 结果
      */
     public int selectTShouhuanAlarmOtherSolve();
+
+    /**
+     * 报警列表
+     *
+     * @return 结果
+     */
+    public List<AlarmStatusListDto> selectAlarmStatusListDto();
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITUserProfileService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TUserProfile;
+import com.ruoyi.system.domain.dto.AddUserDto;
 import com.ruoyi.system.domain.dto.TUserProfileDto;
 import com.ruoyi.system.domain.dto.UserAgeDto;
 
@@ -93,4 +94,11 @@ public interface ITUserProfileService
      * @return 结果
      */
     public Integer selectuserAgeCount();
+
+    /**
+     * 用户新增
+     *
+     * @return 结果
+     */
+    public List<AddUserDto> selectAddUser();
 }

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeviceListServiceImpl.java

@@ -289,4 +289,14 @@ public class TDeviceListServiceImpl implements ITDeviceListService
     public Integer selectDeviceListCount() {
         return tDeviceListMapper.selectDeviceListCount();
     }
+
+    @Override
+    public List<AddDeviceDto> selectAddDevice() {
+        return tDeviceListMapper.selectAddDevice();
+    }
+
+    @Override
+    public Integer selectTDeviceListBandUser() {
+        return tDeviceListMapper.selectTDeviceListBandUser();
+    }
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TShouhuanAlarmListServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
 
 import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.dto.AlarmStatusListDto;
 import com.ruoyi.system.domain.dto.DataAlarmListDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -168,4 +169,9 @@ public class TShouhuanAlarmListServiceImpl implements ITShouhuanAlarmListService
     public int selectTShouhuanAlarmOtherSolve() {
         return tShouhuanAlarmListMapper.selectTShouhuanAlarmOtherSolve();
     }
+
+    @Override
+    public List<AlarmStatusListDto> selectAlarmStatusListDto() {
+        return tShouhuanAlarmListMapper.selectAlarmStatusListDto();
+    }
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TUserProfileServiceImpl.java

@@ -5,6 +5,7 @@ import java.util.List;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.system.domain.TServiceManage;
+import com.ruoyi.system.domain.dto.AddUserDto;
 import com.ruoyi.system.domain.dto.TUserProfileDto;
 import com.ruoyi.system.domain.dto.UserAgeDto;
 import com.ruoyi.system.mapper.TEmergentPeopleMapper;
@@ -186,6 +187,11 @@ public class TUserProfileServiceImpl implements ITUserProfileService
         return tUserProfileMapper.selectuserAgeCount();
     }
 
+    @Override
+    public List<AddUserDto> selectAddUser() {
+        return tUserProfileMapper.selectAddUser();
+    }
+
     public boolean checkManageData(TUserProfile tUserProfile){
         return StringUtils.isNotNull(tUserProfile.getName()) && StringUtils.isNotNull(tUserProfile.getGender()) &&
                 StringUtils.isNotNull(tUserProfile.getSfzid()) && StringUtils.isNotNull(tUserProfile.getTelOne()) &&

+ 6 - 0
ruoyi-system/src/main/resources/mapper/system/TDeviceListMapper.xml

@@ -108,6 +108,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectDeviceListCount" resultType="java.lang.Integer">
         select IFNULL(count(*),0) from t_device_list
     </select>
+    <select id="selectAddDevice" resultType="com.ruoyi.system.domain.dto.AddDeviceDto">
+        SELECT DATE_FORMAT(createtime, '%Y-%m') AS month, COUNT(*) AS count FROM t_device_list GROUP BY month;
+    </select>
+    <select id="selectTDeviceListBandUser" resultType="java.lang.Integer">
+        select count(distinct userid) from t_device_list
+    </select>
 
 
     <insert id="insertTDeviceList" parameterType="TDeviceList" useGeneratedKeys="true" keyProperty="id">

+ 5 - 0
ruoyi-system/src/main/resources/mapper/system/TShouhuanAlarmListMapper.xml

@@ -114,6 +114,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT IFNULL(count(*),0) FROM `t_other_solve`
         where solve_status = 1
     </select>
+    <select id="selectAlarmStatusListDto" resultType="com.ruoyi.system.domain.dto.AlarmStatusListDto">
+        SELECT c.name,a.device_id_code,a.createtime,a.alarm_type FROM `t_shouhuan_alarm_list` a
+        left join t_device_list b on a.device_id_code=b.device_id
+        left join t_user_profile c on c.id=b.userid
+    </select>
 
     <insert id="insertTShouhuanAlarmList" parameterType="TShouhuanAlarmList" useGeneratedKeys="true" keyProperty="id">
         insert into t_shouhuan_alarm_list

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/TUserProfileMapper.xml

@@ -213,6 +213,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectuserAgeCount" resultType="java.lang.Integer">
         select IFNULL(count(*),0) from t_user_profile
     </select>
+    <select id="selectAddUser" resultType="com.ruoyi.system.domain.dto.AddUserDto">
+        SELECT DATE_FORMAT(createtime, '%Y-%m') AS month, COUNT(*) AS count FROM t_user_profile GROUP BY month;
+    </select>
 
     <insert id="insertTUserProfile" parameterType="TUserProfile" useGeneratedKeys="true" keyProperty="id">
         insert into t_user_profile