whyclxw
2025-06-05 c3f2b09d8dc64bc7e8100c01a15cb3c933b5d70e
修改提交
8个文件已修改
2个文件已添加
353 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/StatisticController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Statistic/BattCompareStic.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Statistic/SticCompare16Res.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Statistic/SticCompare17Res.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattInfMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_alarm/BattalarmDataHistory.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattInfService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SubTablePageInfoService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/StatisticController.java
@@ -87,6 +87,22 @@
        return battTinfService.getBattCompare15Statistic(stic);
    }
    @ApiOperation(value = "蓄电池组对比分析界面(不同品牌同一时间)(1.2.16)")
    @PostMapping("getBattCompare16Statistic")
    public Response getBattCompare16Statistic(@RequestBody BattCompareStic stic){
        User uinf= ActionUtil.getUser();
        stic.setUid(uinf.getId());
        return battTinfService.getBattCompare16Statistic(stic);
    }
    @ApiOperation(value = "蓄电池组对比分析界面(同一品牌不同时间)(1.2.17)")
    @PostMapping("getBattCompare17Statistic")
    public Response getBattCompare17Statistic(@RequestBody BattCompareStic stic){
        User uinf= ActionUtil.getUser();
        stic.setUid(uinf.getId());
        return battTinfService.getBattCompare17Statistic(stic);
    }
    @ApiOperation(value = "设备工作状态统计(1.2.21)")
    @PostMapping("getDeviceStateStatistic")
    public Response getDeviceStateStatistic(@RequestBody DeviceStateStic stic){
src/main/java/com/whyc/dto/Statistic/BattCompareStic.java
@@ -14,10 +14,16 @@
    private Integer uid;
    private Integer pageNum;
    private Integer pageSize;
    private Integer performance;//电池性能:1优秀,2劣化,3损坏
    private Integer performance;//电池性能:1优秀,2劣化,3损坏 不传全部
    private String product;
    private Float moncapstd;//标称容量
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date testStartTime;//开始时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date testEndTime;//结束时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date inuseStartTime;//开始时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date inuseEndTime;//结束时间
}
src/main/java/com/whyc/dto/Statistic/SticCompare16Res.java
New file
@@ -0,0 +1,25 @@
package com.whyc.dto.Statistic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class SticCompare16Res {
    private String provice;
    private String city;
    private String country;
    private String stationName;
    private String battgroupName;
    private String product;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date inuseTime;
    private Float monvolstd;
    private Float moncapstd;
    private String stopReason;
    private Float score;           //评分
    private Float realCap;          //实际容量
    private String precentCap;       //容量百分比
    private String capperformance; //性能
}
src/main/java/com/whyc/dto/Statistic/SticCompare17Res.java
New file
@@ -0,0 +1,23 @@
package com.whyc.dto.Statistic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class SticCompare17Res {
    private String provice;
    private String city;
    private String country;
    private String stationName;
    private String battgroupName;
    private String product;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date inuseTime;
    private Float monvolstd;
    private Integer monNum;//单体编号
    private Float monrealCap;          //单体实际容量
    private String monprecentCap;       //单体容量百分比
    private String moncapperformance; //单体性能
}
src/main/java/com/whyc/mapper/BattInfMapper.java
@@ -43,4 +43,8 @@
    List<BattInf> getMonStatistic(@Param("stic") MonStic stic);
    //蓄电池组对比分析界面
    List<BattInf> getBattCompare15Statistic(@Param("stic") BattCompareStic stic);
    //蓄电池组对比分析界面
    List<BattInf> getBattCompare16Statistic(@Param("stic")  BattCompareStic stic);
    //蓄电池组对比分析界面
    List<BattInf> getBattCompare17Statistic(@Param("stic")  BattCompareStic stic);
}
src/main/java/com/whyc/pojo/db_alarm/BattalarmDataHistory.java
@@ -89,6 +89,6 @@
    @TableField(exist = false)
    private String country;//机房名称
    @TableField(exist = false)
    private String battGroupName;//电池组名称
    private String battgroupName;//电池组名称
}
src/main/java/com/whyc/service/BattInfService.java
@@ -448,4 +448,12 @@
        Map<Integer,String> map= Capperformance.getOpInfo();
        return new Response().setII(1,true,map,"获取容量性能(下拉)");
    }
    //蓄电池组对比分析界面
    public List<BattInf> getBattCompare16Statistic(BattCompareStic stic) {
        return mapper.getBattCompare16Statistic(stic);
    }
    //蓄电池组对比分析界面
    public List<BattInf> getBattCompare17Statistic(BattCompareStic stic) {
        return mapper.getBattCompare17Statistic(stic);
    }
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -4,6 +4,7 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.Capperformance;
import com.whyc.constant.StopReasonEnum;
import com.whyc.dto.Response;
import com.whyc.dto.Statistic.*;
import com.whyc.factory.BattCapFactory;
@@ -96,6 +97,20 @@
        wrapper.eq("battgroup_id", battgroupId);
        wrapper.eq("test_type", 3);
        wrapper.eq("test_starttype", 3);
        wrapper.last("  and test_timelong >= 7200 ORDER BY test_starttime DESC ");
        wrapper.last("limit 1");
        BatttestdataInf tinf = mapper.selectOne(wrapper);
        return tinf;
    }
    //获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
    private BatttestdataInf getLastStandardTestDataByTime(Integer battgroupId, Date testStartTime, Date testEndTime) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("battgroup_id", battgroupId);
        wrapper.eq("test_type", 3);
        wrapper.eq("test_starttype", 3);
        wrapper.gt("test_starttime",testStartTime);
        wrapper.lt("test_starttime",testEndTime);
        wrapper.last("  and test_timelong >= 7200 ORDER BY test_starttime DESC ");
        wrapper.last("limit 1");
        BatttestdataInf tinf = mapper.selectOne(wrapper);
@@ -305,17 +320,166 @@
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"蓄电池组对比分析界面(同一品牌同一时间)");
    }
    //获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
    private BatttestdataInf getLastStandardTestDataByTime(Integer battgroupId, Date testStartTime, Date testEndTime) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("battgroup_id", battgroupId);
        wrapper.eq("test_type", 3);
        wrapper.eq("test_starttype", 3);
        wrapper.gt("test_starttime",testStartTime);
        wrapper.lt("test_starttime",testEndTime);
        wrapper.last("  and test_timelong >= 7200 ORDER BY test_starttime DESC ");
        wrapper.last("limit 1");
        BatttestdataInf tinf = mapper.selectOne(wrapper);
        return tinf;
    //蓄电池组对比分析界面(不同品牌同一时间)(1.2.16)
    public Response getBattCompare16Statistic(BattCompareStic stic) {
        //获取核容优劣,损坏参数
        List<AppParam> paramList=appParamService.getHrParam();
        Float badValue=0f;
        Float damageValue=0f;
        if(paramList!=null){
            for (AppParam param:paramList) {
                if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){
                    badValue=param.getParamValue();
                }
                if(param.getParamNamePsx().equals("batt_mon_damage_val")){
                    damageValue=param.getParamValue();
                }
            }
        }
        //1查询符合条件的电池组
        List<BattInf> binfList=battInfService.getBattCompare16Statistic(stic);
        if(binfList==null||binfList.size()==0){
            return new Response().set(1,false,"当前用户未管理满足条件的电池组");
        }
        List<SticCompare16Res> reslist=new ArrayList<>();
        for (BattInf binf:binfList) {
            SticCompare16Res res=new SticCompare16Res();
            res.setProvice(binf.getProvice());
            res.setCity(binf.getCity());
            res.setCountry(binf.getCountry());
            res.setStationName(binf.getStationName());
            res.setBattgroupName(binf.getBattgroupName());
            res.setProduct(binf.getProduct());
            res.setInuseTime(binf.getInuseTime());
            res.setMonvolstd(binf.getMonvolstd());
            res.setMoncapstd(binf.getMoncapstd());
            //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            if(tinf==null){
                res.setRealCap(0f);
                res.setPrecentCap("0");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                res.setStopReason("--");
                continue;
            }
            res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype()));
            Float moncapStd=binf.getMoncapstd();
            int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
            Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
            //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest);
            res.setRealCap(grouprealCap);
            if(grouprealCap>=moncapStd*badValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
            }
            if(grouprealCap<=moncapStd*damageValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
            }
            if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
            }
            //保留5位小数
            String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100));
            //评分的逻辑
            res.setScore(0f);
            res.setPrecentCap(precentCap);
            if(stic.getPerformance()==null){
                reslist.add(res);
            }else{
                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
                    reslist.add(res);
                }
            }
        }
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"蓄电池组对比分析界面(不同品牌同一时间)");
    }
    //蓄电池组对比分析界面(同一品牌不同时间)(1.2.17)
    public Response getBattCompare17Statistic(BattCompareStic stic) {
        //获取核容优劣,损坏参数
        List<AppParam> paramList=appParamService.getHrParam();
        Float badValue=0f;
        Float damageValue=0f;
        if(paramList!=null){
            for (AppParam param:paramList) {
                if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){
                    badValue=param.getParamValue();
                }
                if(param.getParamNamePsx().equals("batt_mon_damage_val")){
                    damageValue=param.getParamValue();
                }
            }
        }
        //1查询符合条件的电池组
        List<BattInf> binfList=battInfService.getBattCompare15Statistic(stic);
        if(binfList==null||binfList.size()==0){
            return new Response().set(1,false,"当前用户未管理满足条件的电池组");
        }
        List<SticCompare17Res> reslist=new ArrayList<>();
        for (BattInf binf:binfList) {
            SticCompare17Res res=new SticCompare17Res();
            res.setProvice(binf.getProvice());
            res.setCity(binf.getCity());
            res.setCountry(binf.getCountry());
            res.setStationName(binf.getStationName());
            res.setBattgroupName(binf.getBattgroupName());
            res.setProduct(binf.getProduct());
            res.setInuseTime(binf.getInuseTime());
            res.setMonvolstd(binf.getMonvolstd());
            //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            /*if(tinf==null){
                res.setMonrealCap(0f);
                res.setMonprecentCap("0");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                continue;
            }
            //找这次放电的最后一笔数据
            List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum());
            if(idDataList==null||idDataList.size()==0){
                res.setRealCap(0f);
                res.setPrecentCap("0");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                continue;
            }
            Float moncapStd=binf.getMoncapstd();
            int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
            Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
            //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest);
            res.setRealCap(grouprealCap);
            if(grouprealCap>=moncapStd*badValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
            }
            if(grouprealCap<=moncapStd*damageValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
            }
            if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
            }
            //保留5位小数
            String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100));
            res.setPrecentCap(precentCap);
            List<Integer> monNums=new ArrayList<>();
            for (BatttestdataId data:idDataList) {//求单体的 实际容量,最小值就是单体的单体电压
                Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real);
                if (monrealCap <= moncapStd * damageValue) {//损坏的
                    monNums.add(data.getMonNum());
                }
            }
            res.setMonNums(monNums);
            if(stic.getPerformance()==0){
                reslist.add(res);
            }else{
                if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){
                    reslist.add(res);
                }
            }
*/
        }
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"蓄电池组对比分析界面(同一品牌同一时间)");
    }
}
src/main/java/com/whyc/service/SubTablePageInfoService.java
@@ -199,7 +199,7 @@
                    data.setProvice(rs.getString("provice"));
                    data.setCity(rs.getString("city"));
                    data.setCountry(rs.getString("country"));
                    data.setBattGroupName(rs.getString("battgroup_name"));
                    data.setBattgroupName(rs.getString("battgroup_name"));
                    list.add(data);
                }
                return list;
src/main/resources/mapper/BattInfMapper.xml
@@ -240,5 +240,82 @@
            order by tb_batt_inf.dev_id asc,battgroup_id asc
        </where>
    </select>
    <select id="getBattCompare16Statistic" resultType="com.whyc.pojo.db_station.BattInf">
        select distinct tb_batt_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_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.product!=null">
                and tb_batt_inf.product=#{stic.product}
            </if>
            <if test="stic.moncapstd!=null">
                and tb_batt_inf.moncapstd=#{stic.moncapstd}
            </if>
            <if test="stic.inuseStartTime!=null">
                and tb_batt_inf.inuse_time>=#{stic.inuseStartTime}
            </if>
            <if test="stic.inuseEndTime!=null">
                and tb_batt_inf.inuse_time&lt;=#{stic.inuseEndTimee}
            </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,battgroup_id asc
        </where>
    </select>
    <select id="getBattCompare17Statistic" resultType="com.whyc.pojo.db_station.BattInf">
        select distinct tb_batt_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_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.product!=null">
            and tb_batt_inf.product=#{stic.product}
        </if>
        <if test="stic.inuseStartTime!=null">
            and tb_batt_inf.inuse_time>=#{stic.inuseStartTime}
        </if>
        <if test="stic.inuseEndTime!=null">
            and tb_batt_inf.inuse_time&lt;=#{stic.inuseEndTimee}
        </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,battgroup_id asc
        </where>
    </select>
</mapper>