Parcourir la source

数据大屏接口

zhengjie il y a 1 an
Parent
commit
94c257305f

+ 57 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDataDisplayController.java

@@ -13,9 +13,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.TShouhuanAlarmList;
 import com.ruoyi.system.domain.TSosSolve;
 import com.ruoyi.system.domain.dto.*;
-import com.ruoyi.system.service.ITDeviceListService;
-import com.ruoyi.system.service.ITShouhuanAlarmListService;
-import com.ruoyi.system.service.ITSosSolveService;
+import com.ruoyi.system.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -43,6 +41,12 @@ public class TDataDisplayController extends BaseController
     @Autowired
     private ITDeviceListService tDeviceListService;
 
+    @Autowired
+    private ITShouhuanInfoService itShouhuanInfoService;
+
+    @Autowired
+    private ITUserProfileService userProfileService;
+
     @Autowired
     private LocationUtils locationUtils;
 
@@ -122,8 +126,45 @@ public class TDataDisplayController extends BaseController
     public AjaxResult deviceView()
     {
         DeviceViewDto dto = new DeviceViewDto();
-        return success();
+        dto.setDeviceCount(tShouhuanAlarmListService.selectTShouhuanAlarmStatus() + tShouhuanAlarmListService.selectTShouhuanAlarmStatusSolve());
+        dto.setDeviceOnline(tShouhuanAlarmListService.selectTShouhuanAlarmStatus());
+        dto.setUn_deviceOnline(tShouhuanAlarmListService.selectTShouhuanAlarmStatusSolve());
+        dto.setAlarmCount(tShouhuanAlarmListService.selectTShouhuanAlarmListCount());
+        return success(dto);
+    }
+
+    /**
+     * 总数
+     */
+    @GetMapping("/deviceType")
+    public AjaxResult deviceType()
+    {
+        Integer total = tDeviceListService.selectDeviceListCount();
+        List<DeviceTypeDto> deviceListDto = tDeviceListService.selectDeviceListDto();
+        for (DeviceTypeDto listDto : deviceListDto){
+            listDto.setDeviceStr(checkDeviceType(listDto.getDevice_model()));
+            listDto.setDevicePercent(checkPercent(listDto.getCount(),total));
+        }
+        AjaxResult ajax = new AjaxResult();
+        ajax.put("list",deviceListDto);
+        ajax.put("total", total);
+        return AjaxResult.success("操作成功",ajax);
     }
+
+    /**
+     * 总数
+     */
+    @GetMapping("/userAgeAll")
+    public AjaxResult userAgeAll()
+    {
+        Integer total = userProfileService.selectuserAgeCount();
+        List<UserAgeDto> dtoList = userProfileService.selectuserAgeDto();
+        AjaxResult ajax = new AjaxResult();
+        ajax.put("list",dtoList);
+        ajax.put("total", total);
+        return AjaxResult.success("操作成功",ajax);
+    }
+
     /**
      * 查询SOS预警处理列表
      */
@@ -135,6 +176,7 @@ public class TDataDisplayController extends BaseController
         for (DataAlarmListDto dto : list){
             MessageAlarmListDto alarmListDto = new MessageAlarmListDto();
             alarmListDto.setName(dto.getName());
+            alarmListDto.setAlarm_msg(tDeviceListService.checkMessage(dto.getAlarm_type()));
             alarmListDto.setTelno(dto.getTel_one());
             alarmListDto.setGps_long(dto.getGps_long());
             alarmListDto.setGps_lat(dto.getGps_lat());
@@ -173,4 +215,15 @@ public class TDataDisplayController extends BaseController
         String result = numberFormat.format((float)num1/(float)num2*100);
         return result;
     }
+
+    public String checkDeviceType(Integer device_model){
+        switch (device_model){
+            case 0:
+                return "S8";
+            case 1:
+                return "X5";
+            default:
+                return "无效";
+        }
+    }
 }

+ 34 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/DeviceListDto.java

@@ -0,0 +1,34 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.common.annotation.Excel;
+
+import java.util.List;
+
+public class DeviceListDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 类型 */
+    @Excel(name = "类型")
+    private Integer device_model;
+
+    /** 数量 */
+    @Excel(name = "数量")
+    private Integer count;
+
+    public Integer getDevice_model() {
+        return device_model;
+    }
+
+    public void setDevice_model(Integer device_model) {
+        this.device_model = device_model;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}

+ 51 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/DeviceTypeDto.java

@@ -0,0 +1,51 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.common.annotation.Excel;
+
+import java.util.List;
+
+public class DeviceTypeDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /* 类型 */
+    private Integer device_model;
+    /* 名称 */
+    private String deviceStr;
+    /* 数量 */
+    private Integer count;
+    /* 占比 */
+    private String devicePercent;
+
+    public Integer getDevice_model() {
+        return device_model;
+    }
+
+    public void setDevice_model(Integer device_model) {
+        this.device_model = device_model;
+    }
+
+    public String getDeviceStr() {
+        return deviceStr;
+    }
+
+    public void setDeviceStr(String deviceStr) {
+        this.deviceStr = deviceStr;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+
+    public String getDevicePercent() {
+        return devicePercent;
+    }
+
+    public void setDevicePercent(String devicePercent) {
+        this.devicePercent = devicePercent;
+    }
+}

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MessageAlarmListDto.java

@@ -13,6 +13,10 @@ public class MessageAlarmListDto {
     @Excel(name = "告警内容")
     private Integer alarm_type;
 
+    /** 告警信息 */
+    @Excel(name = "告警信息")
+    private String alarm_msg;
+
     /** 姓名 */
     @Excel(name = "姓名")
     private String name;
@@ -93,4 +97,12 @@ public class MessageAlarmListDto {
     public void setCreatetime(Date createtime) {
         this.createtime = createtime;
     }
+
+    public String getAlarm_msg() {
+        return alarm_msg;
+    }
+
+    public void setAlarm_msg(String alarm_msg) {
+        this.alarm_msg = alarm_msg;
+    }
 }

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

@@ -0,0 +1,32 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.common.annotation.Excel;
+
+public class UserAgeDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 名称 */
+    @Excel(name = "名称")
+    private String age;
+
+    /** 数量 */
+    @Excel(name = "数量")
+    private Integer count;
+
+    public String getAge() {
+        return age;
+    }
+
+    public void setAge(String age) {
+        this.age = age;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}

+ 14 - 4
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDeviceListMapper.java

@@ -3,10 +3,7 @@ package com.ruoyi.system.mapper;
 import java.util.List;
 
 import com.ruoyi.system.domain.TDeviceList;
-import com.ruoyi.system.domain.dto.MessageDto;
-import com.ruoyi.system.domain.dto.MessageLogDto;
-import com.ruoyi.system.domain.dto.RateDto;
-import com.ruoyi.system.domain.dto.SettingDto;
+import com.ruoyi.system.domain.dto.*;
 
 /**
  * 设备列Mapper接口
@@ -197,4 +194,17 @@ public interface TDeviceListMapper
      */
     public String selectshouhuan(String use_key);
 
+    /**
+     * 最大心率
+     *
+     * @return 结果
+     */
+    public List<DeviceTypeDto> selectDeviceListDto();
+
+    /**
+     * 最大心率
+     *
+     * @return 结果
+     */
+    public Integer selectDeviceListCount();
 }

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

@@ -8,6 +8,7 @@ import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TUserProfile;
 import com.ruoyi.system.domain.TEmergentPeople;
 import com.ruoyi.system.domain.dto.TUserProfileDto;
+import com.ruoyi.system.domain.dto.UserAgeDto;
 
 /**
  * 用户档案Mapper接口
@@ -105,4 +106,18 @@ public interface TUserProfileMapper
      * @return 结果
      */
     public int deleteTEmergentPeopleByProfileId(Integer id);
+
+    /**
+     * 用户年龄
+     *
+     * @return 结果
+     */
+    public List<UserAgeDto> selectuserAgeDto();
+
+    /**
+     * 用户总数
+     *
+     * @return 结果
+     */
+    public Integer selectuserAgeCount();
 }

+ 15 - 4
ruoyi-system/src/main/java/com/ruoyi/system/service/ITDeviceListService.java

@@ -3,10 +3,7 @@ package com.ruoyi.system.service;
 import java.util.List;
 import com.ruoyi.system.domain.TDeviceList;
 import com.ruoyi.system.domain.TServiceManage;
-import com.ruoyi.system.domain.dto.CallPoliceDto;
-import com.ruoyi.system.domain.dto.MessageDto;
-import com.ruoyi.system.domain.dto.MessageLogDto;
-import com.ruoyi.system.domain.dto.RateDto;
+import com.ruoyi.system.domain.dto.*;
 
 /**
  * 设备列Service接口
@@ -143,4 +140,18 @@ public interface ITDeviceListService
      * @return 结果
      */
     public int deviceValue(CallPoliceDto callPoliceDto);
+
+    /**
+     * 最大心率
+     *
+     * @return 结果
+     */
+    public List<DeviceTypeDto> selectDeviceListDto();
+
+    /**
+     * 最大心率
+     *
+     * @return 结果
+     */
+    public Integer selectDeviceListCount();
 }

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

@@ -5,6 +5,7 @@ import java.util.List;
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TUserProfile;
 import com.ruoyi.system.domain.dto.TUserProfileDto;
+import com.ruoyi.system.domain.dto.UserAgeDto;
 
 /**
  * 用户档案Service接口
@@ -78,4 +79,18 @@ public interface ITUserProfileService
      * @return 结果
      */
     public String importTUserProfile(List<TUserProfile> tUserProfileList);
+
+    /**
+     * 用户年龄
+     *
+     * @return 结果
+     */
+    public List<UserAgeDto> selectuserAgeDto();
+
+    /**
+     * 用户总数
+     *
+     * @return 结果
+     */
+    public Integer selectuserAgeCount();
 }

+ 11 - 4
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeviceListServiceImpl.java

@@ -9,10 +9,7 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.TFacility;
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TUserProfile;
-import com.ruoyi.system.domain.dto.CallPoliceDto;
-import com.ruoyi.system.domain.dto.MessageDto;
-import com.ruoyi.system.domain.dto.MessageLogDto;
-import com.ruoyi.system.domain.dto.RateDto;
+import com.ruoyi.system.domain.dto.*;
 import com.ruoyi.system.mapper.TFacilityMapper;
 import com.ruoyi.system.mapper.TUserProfileMapper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -282,4 +279,14 @@ public class TDeviceListServiceImpl implements ITDeviceListService
             return 0;
         }
     }
+
+    @Override
+    public List<DeviceTypeDto> selectDeviceListDto() {
+        return tDeviceListMapper.selectDeviceListDto();
+    }
+
+    @Override
+    public Integer selectDeviceListCount() {
+        return tDeviceListMapper.selectDeviceListCount();
+    }
 }

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

@@ -6,6 +6,7 @@ import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.dto.TUserProfileDto;
+import com.ruoyi.system.domain.dto.UserAgeDto;
 import com.ruoyi.system.mapper.TEmergentPeopleMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -175,6 +176,16 @@ public class TUserProfileServiceImpl implements ITUserProfileService
         return successMsg.toString();
     }
 
+    @Override
+    public List<UserAgeDto> selectuserAgeDto() {
+        return tUserProfileMapper.selectuserAgeDto();
+    }
+
+    @Override
+    public Integer selectuserAgeCount() {
+        return tUserProfileMapper.selectuserAgeCount();
+    }
+
     public boolean checkManageData(TUserProfile tUserProfile){
         return StringUtils.isNotNull(tUserProfile.getName()) && StringUtils.isNotNull(tUserProfile.getGender()) &&
                 StringUtils.isNotNull(tUserProfile.getSfzid()) && StringUtils.isNotNull(tUserProfile.getTelOne()) &&

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

@@ -101,6 +101,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select use_value from t_setting
         where use_key = #{use_key}
     </select>
+    <select id="selectDeviceListDto" resultType="com.ruoyi.system.domain.dto.DeviceTypeDto">
+        select device_model,count(device_model) as count from t_device_list
+        group by device_model
+    </select>
+    <select id="selectDeviceListCount" resultType="java.lang.Integer">
+        select IFNULL(count(*),0) from t_device_list
+    </select>
+
 
     <insert id="insertTDeviceList" parameterType="TDeviceList" useGeneratedKeys="true" keyProperty="id">
         insert into t_device_list

+ 0 - 1
ruoyi-system/src/main/resources/mapper/system/TShouhuanInfoMapper.xml

@@ -99,7 +99,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectTShouhuanInfo" parameterType="TShouhuanInfo" resultMap="TShouhuanInfoResult">
         <include refid="selectTShouhuanInfoVo"/>
     </select>
-
     <insert id="insertTShouhuanInfo" parameterType="TShouhuanInfo" useGeneratedKeys="true" keyProperty="id">
         insert into t_shouhuan_info
         <trim prefix="(" suffix=")" suffixOverrides=",">

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

@@ -143,6 +143,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select id, name, gender, sfzid, tel_one, age, family_address from t_user_profile
         where sfzid = #{sfzid}
     </select>
+    <select id="selectuserAgeDto" resultType="com.ruoyi.system.domain.dto.UserAgeDto">
+        SELECT
+        CASE
+        WHEN age IS NULL THEN
+        '未知'
+        WHEN age &gt;= 10
+        AND age &lt; 20 THEN
+        '10'
+        WHEN age &gt;= 20
+        AND age &lt; 30 THEN
+        '20'
+        WHEN age &gt;= 30
+        AND age &lt; 40 THEN
+        '30'
+        WHEN age &gt;= 40
+        AND age &lt; 50 THEN
+        '40'
+        WHEN age &gt;= 50
+        AND age &lt; 60 THEN
+        '50'
+        WHEN age &gt;= 60
+        AND age &lt; 70 THEN
+        '60'
+        WHEN age &gt;= 70
+        AND age &lt; 80 THEN
+        '70'
+        WHEN age &gt;= 80
+        AND age &lt; 90 THEN
+        '80'
+        WHEN age &gt; 90 THEN
+        '100以上'
+        END AS age,
+        count(*) AS count
+        FROM
+        t_user_profile
+        GROUP BY
+        CASE
+        WHEN age IS NULL THEN
+        '未知'
+        WHEN age &gt;= 10
+        AND age &lt; 20 THEN
+        '10'
+        WHEN age &gt;= 20
+        AND age &lt; 30 THEN
+        '20'
+        WHEN age &gt;= 30
+        AND age &lt; 40 THEN
+        '30'
+        WHEN age &gt;= 40
+        AND age &lt; 50 THEN
+        '40'
+        WHEN age &gt;= 50
+        AND age &lt; 60 THEN
+        '50'
+        WHEN age &gt;= 60
+        AND age &lt; 70 THEN
+        '60'
+        WHEN age &gt;= 70
+        AND age &lt; 80 THEN
+        '70'
+        WHEN age &gt;= 80
+        AND age &lt; 90 THEN
+        '80'
+        WHEN age &gt; 90 THEN
+        '100以上'
+        END;
+    </select>
+    <select id="selectuserAgeCount" resultType="java.lang.Integer">
+        select IFNULL(count(*),0) from t_user_profile
+    </select>
 
     <insert id="insertTUserProfile" parameterType="TUserProfile" useGeneratedKeys="true" keyProperty="id">
         insert into t_user_profile

+ 2 - 2
ruoyi-ui/vue.config.js

@@ -35,8 +35,8 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        // target: `http://localhost:8088`,
-        target: `http://118.195.207.241:8088`,
+        target: `http://localhost:8088`,
+        // target: `http://118.195.207.241:8088`,
         // target: `http://152.136.61.163`,
         changeOrigin: true,
         pathRewrite: {