whyclxw
2025-05-30 10a094864f75928f853e1ebb0311b0a20b858901
设备信息统计
8个文件已修改
97 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/StatisticController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattInfMapper.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_station/BattInf.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_station/PowerInf.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattInfService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/PowerInfMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/StatisticController.java
@@ -5,10 +5,7 @@
import com.whyc.dto.Statistic.DeviceStateStic;
import com.whyc.dto.Statistic.StationStic;
import com.whyc.pojo.db_user.User;
import com.whyc.service.BatttestdataInfService;
import com.whyc.service.DeviceStateService;
import com.whyc.service.PowerInfService;
import com.whyc.service.StationInfService;
import com.whyc.service.*;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -27,6 +24,8 @@
    @Autowired
    private BatttestdataInfService battTinfService;
    @Autowired
    private BattInfService battService;
    @Autowired
    private PowerInfService powerInfService;
@@ -42,6 +41,16 @@
        return powerInfService.getPowerStatistic(stic);
    }
    @ApiOperation(value = "设备信息统计")
    @PostMapping("getDevStatistic")
    public Response getDevStatistic(@RequestBody StationStic stic){
        User uinf= ActionUtil.getUser();
        stic.setUid(uinf.getId());
        return battService.getDevStatistic(stic);
    }
    @ApiOperation(value = "站点信息统计")
    @PostMapping("getStationStatistic")
    public Response getStationStatistic(@RequestBody StationStic stic){
src/main/java/com/whyc/mapper/BattInfMapper.java
@@ -2,6 +2,7 @@
import com.whyc.dto.BattDto;
import com.whyc.dto.InfoDto;
import com.whyc.dto.Statistic.StationStic;
import com.whyc.pojo.db_station.BattInf;
import org.apache.ibatis.annotations.Param;
@@ -30,5 +31,8 @@
    //获取标称内阻(下拉)
    List<Float> getMonResByUid(@Param("uid") Integer uid);
    //设备信息统计
    List<BattInf> getDevStatistic(@Param("stic") StationStic stic);
    //获取设备下电池组个数
    Integer getBattCountBydevId(Integer devId);
}
src/main/java/com/whyc/pojo/db_station/BattInf.java
@@ -94,5 +94,22 @@
    @ApiModelProperty(value = "0:设备下新建电池组,1新建一个设备一个电池组")
    private Integer addBinfFlag;
    @TableField(exist = false)
    private String provice;
    @TableField(exist = false)
    private String city;
    @TableField(exist = false)
    private String country;
    @TableField(exist = false)
    private String fullName;
    @TableField(exist = false)
    private String stationType;
    @TableField(exist = false)
    @ApiModelProperty(value = "设备下电池组个数")
    private Integer battCount;
}
src/main/java/com/whyc/pojo/db_station/PowerInf.java
@@ -72,12 +72,14 @@
    @TableField(exist = false)
    private String city;
    @TableField(exist = false)
    private String country;
    @TableField(exist = false)
    private String fullName;
    @TableField(exist = false)
    private String stationType;
}
src/main/java/com/whyc/service/BattInfService.java
@@ -8,6 +8,7 @@
import com.whyc.dto.InfoDto;
import com.whyc.dto.Real.QuarterDto;
import com.whyc.dto.Response;
import com.whyc.dto.Statistic.StationStic;
import com.whyc.factory.InfoFactory;
import com.whyc.mapper.BattInfMapper;
import com.whyc.mapper.PowerInfMapper;
@@ -403,4 +404,17 @@
        }
        return list;
    }
    //设备信息统计
    public Response getDevStatistic(StationStic stic) {
        PageHelper.startPage(stic.getPageNum(),stic.getPageSize());
        List<BattInf> list=mapper.getDevStatistic(stic);
        for (BattInf binf:list) {
            //获取设备下电池组个数
            int battCount=mapper.getBattCountBydevId(binf.getDevId());
            binf.setBattCount(battCount);
        }
        PageInfo<BattInf> pageInfo=new PageInfo<>(list);
        return new Response().setII(1,list.size()>0,pageInfo,"设备信息统计");
    }
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -5,6 +5,7 @@
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.dto.Statistic.BattTinfStic;
import com.whyc.dto.Statistic.StationStic;
import com.whyc.factory.BattCapFactory;
import com.whyc.mapper.BattInfMapper;
import com.whyc.mapper.BatttestdataInfMapper;
src/main/resources/mapper/BattInfMapper.xml
@@ -110,5 +110,40 @@
            </if>
        </where>
    </select>
    <select id="getDevStatistic" resultType="com.whyc.pojo.db_station.BattInf">
        select distinct tb_batt_inf.dev_id,tb_batt_inf.dev_name,tb_batt_inf.dev_type,tb_batt_inf.dev_num,tb_batt_inf.dev_ip
        ,tb_batt_inf.station_id,tb_batt_inf.power_id
        ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name
        from db_station.tb_batt_inf,db_station.tb_station_inf
        <where>
            tb_batt_inf.station_id=tb_station_inf.station_id
            <if test="stic.provice!=null">
                and tb_station_inf.provice=#{stic.provice}
            </if>
            <if test="stic.city!=null">
                and tb_station_inf.city=#{stic.city}
            </if>
            <if test="stic.country!=null">
                and tb_station_inf.country=#{stic.country}
            </if>
            <if test="stic.stationName!=null">
                and tb_station_inf.station_name=#{stic.stationName}
            </if>
            <if test="stic.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=#{stic.uid}
                )
            </if>
            order by tb_batt_inf.dev_id asc
        </where>
    </select>
    <select id="getBattCountBydevId" resultType="java.lang.Integer">
        select ifnull(count(*),0)  from db_station.tb_batt_inf
        <where>
            dev_id=#{devId}
        </where>
    </select>
</mapper>
src/main/resources/mapper/PowerInfMapper.xml
@@ -78,7 +78,8 @@
        </where>
    </select>
    <select id="getPowerStatistic" resultType="com.whyc.pojo.db_station.PowerInf">
        select distinct tb_power_inf.*,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name
        select distinct tb_power_inf.*
        ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name
        from db_station.tb_power_inf,db_station.tb_station_inf
        <where>
            tb_power_inf.station_id=tb_station_inf.station_id