whyclxw
5 天以前 bae185d2ff22c2537adc298cac905c9f5394d3c5
预警分析添加设备实时告警
13个文件已修改
115 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/AnalysisAlmController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Param/AlmAnalyseDto.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattInfMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/DevalarmDataMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_alarm/DevalarmData.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattInfService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattalarmDataService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/DevalarmDataService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/PwrdevAlarmService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattalarmDataMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/DevalarmDataMapper.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/PwrdevAlarmMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/AnalysisAlmController.java
@@ -1,12 +1,13 @@
package com.whyc.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.BattSingalIdEnum;
import com.whyc.dto.AnalysisAlm.AnalysisChangeRes;
import com.whyc.dto.Param.AlmAnalyseDto;
import com.whyc.dto.Response;
import com.whyc.service.AlmAnalysisParamService;
import com.whyc.service.BattRealdataIdService;
import com.whyc.service.BattalarmDataService;
import com.whyc.service.PwrdevAlarmService;
import com.whyc.pojo.db_alarm.BattalarmData;
import com.whyc.service.*;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -14,6 +15,7 @@
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.util.List;
@RequestMapping("analysis")
@RestController
@@ -27,6 +29,10 @@
    @Autowired
    private AlmAnalysisParamService almAnalysisParamService;
    @Autowired
    private DevalarmDataService  devalarmDataService;
    @PostMapping("getBattAlmAnalyse")
    @ApiOperation("预警分析管理-电池告警")
    public Response getBattAlmAnalyse(@RequestBody AlmAnalyseDto dto){
@@ -35,6 +41,14 @@
        return battalarmDataService.getBattAlmAnalyse(dto);
    }
    @PostMapping("getDevAlmAnalyse")
    @ApiOperation("预警分析管理-设备告警")
    public Response getDevAlmAnalyse(@RequestBody AlmAnalyseDto dto){
        Integer uid= ActionUtil.getUser().getId();
        dto.setUid(uid);
        return devalarmDataService.getDevAlmAnalyse(dto);
    }
    @PostMapping("getPwrtAlmAnalyse")
    @ApiOperation("预警分析管理-电源告警")
    public Response getPwrtAlmAnalyse(@RequestBody AlmAnalyseDto dto){
src/main/java/com/whyc/dto/Param/AlmAnalyseDto.java
@@ -11,6 +11,7 @@
    private String country;
    private Integer stationId;
    private Integer powerId;
    private Integer devId;
    private Integer battgroupId;
    private List<Integer> almIdList;
    private Integer uid;
src/main/java/com/whyc/mapper/BattInfMapper.java
@@ -64,5 +64,7 @@
    //根据查询条件获取电池组集合
    BattInf getBattgroupIdInf(@Param("battgroupId") Integer battgroupId);
    //查询电源下所有的电池组id
    List<Integer> getBattgroupIdList(@Param("powerId") Integer powerId);
    List<Integer> getBattgroupIdListByPowerId(@Param("powerId") Integer powerId);
    //查询设备下所有的电池组id
    List<Integer> getBattgroupIdListByDevId(@Param("devId") Integer devId);
}
src/main/java/com/whyc/mapper/DevalarmDataMapper.java
@@ -1,9 +1,11 @@
package com.whyc.mapper;
import com.whyc.dto.AlarmDto;
import com.whyc.dto.Param.AlmAnalyseDto;
import com.whyc.dto.Real.AlmDto;
import com.whyc.pojo.db_alarm.DevalarmData;
import com.whyc.pojo.web_site.AlarmInspection;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -14,5 +16,6 @@
    List<AlarmInspection> getListGreatThan(Long devAlarmId);
    List<AlarmDto> getListByUserId(Integer userId, Integer almLevel);
    //预警分析管理-设备告警
    List<DevalarmData> getDevAlmAnalyse(AlmAnalyseDto almDto);
}
src/main/java/com/whyc/pojo/db_alarm/DevalarmData.java
@@ -12,6 +12,7 @@
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * <p>
@@ -93,5 +94,7 @@
    private String country;
    @TableField(exist = false)
    private String fullName;
    @TableField(exist = false)
    private List<Integer> battgroupIdList;
}
src/main/java/com/whyc/service/BattInfService.java
@@ -495,7 +495,11 @@
        return mapper.getBattgroupIdInf(battgroupId);
    }
    //查询电源下所有的电池组id
    public List<Integer> getBattgroupIdList(Integer powerId) {
        return mapper.getBattgroupIdList(powerId);
    public List<Integer> getBattgroupIdListByPowerId(Integer powerId) {
        return mapper.getBattgroupIdListByPowerId(powerId);
    }
    //查询设备下所有的电池组id
    public List<Integer> getBattgroupIdListByDevId(Integer devId) {
        return mapper.getBattgroupIdListByDevId(devId);
    }
}
src/main/java/com/whyc/service/BattalarmDataService.java
@@ -38,6 +38,7 @@
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"获取电池组实时告警信息");
    }
    //确认电池告警
    public Response updateBattConfrim(Integer num) {
        UpdateWrapper wrapper = new UpdateWrapper<>();
@@ -98,4 +99,5 @@
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"电池告警分析");
    }
}
src/main/java/com/whyc/service/DevalarmDataService.java
@@ -9,9 +9,11 @@
import com.whyc.constant.BattSingalIdEnum;
import com.whyc.constant.DevAlarmEnum;
import com.whyc.dto.AlarmDto;
import com.whyc.dto.Param.AlmAnalyseDto;
import com.whyc.dto.Real.AlmDto;
import com.whyc.dto.Response;
import com.whyc.mapper.DevalarmDataMapper;
import com.whyc.pojo.db_alarm.BattalarmData;
import com.whyc.pojo.db_alarm.DevalarmData;
import com.whyc.pojo.web_site.AlarmInspection;
import com.whyc.util.ActionUtil;
@@ -28,6 +30,9 @@
public class DevalarmDataService {
    @Autowired(required = false)
    private DevalarmDataMapper mapper;
    @Autowired
    private BattInfService battInfService;
    //获取设备实时告警信息
    public Response getDevAlmReal(AlmDto almDto) {
        PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize());
@@ -84,4 +89,18 @@
    public List<AlarmDto> getListByUserId(Integer userId,Integer almLevel) {
        return mapper.getListByUserId(userId,almLevel);
    }
    //预警分析管理-设备告警
    public Response getDevAlmAnalyse(AlmAnalyseDto almDto) {
        PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize());
        List<DevalarmData> list=mapper.getDevAlmAnalyse(almDto);
        list.forEach(data->{
            data.setAlmName(DevAlarmEnum.getValue(data.getAlmId()));
            //查询设备下所有的电池组id
            List<Integer> battgroupIdList = battInfService.getBattgroupIdListByDevId(data.getDevId());
            data.setBattgroupIdList(battgroupIdList);
        });
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"获取设备实时告警信息");
    }
}
src/main/java/com/whyc/service/PwrdevAlarmService.java
@@ -114,7 +114,7 @@
        for (PwrdevAlarm pwrAlm:list) {
            pwrAlm.setAlmName(PowerAlarmEnum.getValue(pwrAlm.getAlmId()));
            //查询电源下所有的电池组id
            List<Integer> battgroupIdList = battInfService.getBattgroupIdList(pwrAlm.getPowerId());
            List<Integer> battgroupIdList = battInfService.getBattgroupIdListByPowerId(pwrAlm.getPowerId());
            pwrAlm.setBattgroupIdList(battgroupIdList);
        }
        PageInfo pageInfo=new PageInfo(list);
src/main/resources/mapper/BattInfMapper.xml
@@ -476,7 +476,7 @@
        </where>
        limit 1
    </select>
    <select id="getBattgroupIdList" resultType="java.lang.Integer">
    <select id="getBattgroupIdListByPowerId" resultType="java.lang.Integer">
        select distinct tb_batt_inf.battgroup_id
        from db_station.tb_batt_inf
        <where>
@@ -484,4 +484,12 @@
        </where>
        order by battgroup_num asc
    </select>
    <select id="getBattgroupIdListByDevId" resultType="java.lang.Integer">
        select distinct tb_batt_inf.battgroup_id
        from db_station.tb_batt_inf
        <where>
            tb_batt_inf.dev_id=#{devId}
        </where>
        order by battgroup_num asc
    </select>
</mapper>
src/main/resources/mapper/BattalarmDataMapper.xml
@@ -93,6 +93,9 @@
            <if test="country!=null">
                and tb_station_inf.country=#{country}
            </if>
            <if test="almLevel!=null">
                and tb_battalarm_data.alm_level=#{almLevel}
            </if>
            <if test="stationId!=null">
                and tb_station_inf.station_id=#{stationId}
            </if>
src/main/resources/mapper/DevalarmDataMapper.xml
@@ -63,4 +63,37 @@
            and bu.uid = #{userId}
        )
    </select>
    <select id="getDevAlmAnalyse" resultType="com.whyc.pojo.db_alarm.DevalarmData">
        select tb_devalarm_data.*,tb_batt_inf.dev_name,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name
        from db_alarm.tb_devalarm_data,db_station.tb_batt_inf,db_station.tb_station_inf
        <where>
            tb_devalarm_data.dev_id=tb_batt_inf.dev_id
            and tb_batt_inf.station_id=tb_station_inf.station_id
            <if test="provice!=null">
                and tb_station_inf.provice=#{provice}
            </if>
            <if test="city!=null">
                and tb_station_inf.city=#{city}
            </if>
            <if test="country!=null">
                and tb_station_inf.country=#{country}
            </if>
            <if test="stationId!=null">
                and tb_station_inf.station_id=#{stationId}
            </if>
            <if test="devId!=null">
                and tb_devalarm_data.dev_id=#{devId}
            </if>
            <if test="almLevel!=null">
                and tb_devalarm_data.alm_level=#{almLevel}
            </if>
            <if test="uid>100">
                and tb_batt_inf.station_id in(
                select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
                where   tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id
                and tb_baojigroup_usr.uid=#{uid}
                )
            </if>
        </where>
    </select>
</mapper>
src/main/resources/mapper/PwrdevAlarmMapper.xml
@@ -84,6 +84,9 @@
            <if test="powerId!=null">
                and tb_pwrdev_alarm.power_id=#{powerId}
            </if>
            <if test="almLevel!=null">
                and tb_pwrdev_alarm.alm_level=#{almLevel}
            </if>
            <if test="uid>100">
                and tb_pwrdev_alarm.power_id in(
                select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr