whyclxw
2025-06-12 ac4f36a716198037fc9d3af8c51b4be9ca159b96
蓄电池组1.2.5,1.2.6
8个文件已修改
1个文件已添加
189 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/ConditionController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/StatisticController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Response.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/Statistic/Pwr7Stic.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattInfMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BaojigroupService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattInfService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ConditionController.java
@@ -1,6 +1,7 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.pojo.db_user.Baojigroup;
import com.whyc.pojo.db_user.User;
import com.whyc.service.*;
import com.whyc.util.ActionUtil;
@@ -8,6 +9,8 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Api(tags = "下拉条件管理")
@@ -188,6 +191,13 @@
        return rtstateService.getBattState();
    }
    @ApiOperation(value = "获取所有的班组(下拉)")
    @GetMapping("getBattGroupBZ")
    public Response getBattGroupBZ(){
        List<Baojigroup> list=bjGroupService.getGroupList();
        return new Response().setII(1,true,list,"获取所有的班组(下拉)");
    }
}
src/main/java/com/whyc/controller/StatisticController.java
@@ -92,7 +92,13 @@
        }
        return battTinfService.getDischr6Statistic(stic);
    }
    @ApiOperation(value = "优良电源数量统计(1.2.7)")
    @PostMapping("getPwr7Statistic")
    public Response getPwr7Statistic(@RequestBody Pwr7Stic stic){
        User uinf= ActionUtil.getUser();
        stic.setUid(uinf.getId());
        return battTinfService.getPwr7Statistic(stic);
    }
    @ApiOperation(value = "电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10)")
    @PostMapping("getPerformanceStatistic")
    public Response getPerformanceStatistic(@RequestBody PerformanceStic stic){
src/main/java/com/whyc/dto/Response.java
@@ -18,6 +18,7 @@
    private T data;
    private T data2;
    private T data3;
    private T data4;
    private String msg;
    public Response<T> setCode(Integer code) {
@@ -69,6 +70,15 @@
        this.data3 = data3;
        return this;
    }
    public Response<T> setIIII(Integer code, T data, T data2, T data3,T data4, String msg) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.data2 = data2;
        this.data3 = data3;
        this.data4 = data4;
        return this;
    }
    public Integer getCode() {
        return code;
@@ -101,4 +111,12 @@
    public void setData3(T data3) {
        this.data3 = data3;
    }
    public T getData4() {
        return data4;
    }
    public void setData4(T data4) {
        this.data4 = data4;
    }
}
src/main/java/com/whyc/dto/Statistic/Pwr7Stic.java
New file
@@ -0,0 +1,26 @@
package com.whyc.dto.Statistic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class Pwr7Stic {
    private String provice;
    private String city;
    private String country;
    private String stationName;
    private String battgroupName;
    private String product;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date inuseStartTime;//开始时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date inuseEndTime;//结束时间
    private Float monvolstd;
    private Integer performance;//电池性能:1优秀,2劣化,3损坏 4未放电 不传全部
    private Integer baojiGroupId;
    private Integer uid;
    private Integer pageNum;
    private Integer pageSize;
}
src/main/java/com/whyc/mapper/BattInfMapper.java
@@ -53,4 +53,6 @@
    List<BattInf> getPerformanceStatistic(@Param("stic") PerformanceStic stic);
    //本年度已/未放电数量统计右侧图表(1.2.5)
    List<BattInf> getDischrChart(@Param("uid") Integer uid);
    //优良电源数量统计(1.2.7)
    List<BattInf> getPwr7Statistic(@Param("stic") Pwr7Stic stic);
}
src/main/java/com/whyc/service/BaojigroupService.java
@@ -249,7 +249,7 @@
        String groupName = powerInfMapper.getGroupName(powerId);
        return  groupName;
    }
    //查询所有的包机组名集合
    //查询所有的包机组名集合(班组)
    public List<Baojigroup> getGroupList() {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("team_flag",1);
src/main/java/com/whyc/service/BattInfService.java
@@ -473,4 +473,8 @@
    public List<BattInf> getDischrChart(Integer uid) {
        return mapper.getDischrChart(uid);
    }
    //优良电源数量统计(1.2.7)
    public List<BattInf> getPwr7Statistic(Pwr7Stic stic) {
        return mapper.getPwr7Statistic(stic);
    }
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -612,8 +612,18 @@
        }
        return new Response().setII(1,true,map,"历史测试记录");
    }
    //本年度已放电数量统计(1.2.5)
    //本年度已放电数量统计(1.2.5)<只查看已放电数据>
    public Response getDischr5Statistic(DisChargeStic stic) {
        //班组
        Map<String,  Object> bzmap=new HashMap<>();
        //性能
        Map<String,  Integer> xnmap=new HashMap<>();
        xnmap.put("优秀",0);
        xnmap.put("劣化",0);
        xnmap.put("损坏",0);
        xnmap.put("未放电",0);
        //查询出所有的班组并赋予初始值
        setBanZuDefault(bzmap);
        //获取核容优劣,损坏参数
        List<AppParam> paramList=appParamService.getHrParam();
        Float badValue=0f;
@@ -647,16 +657,21 @@
            //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            if(tinf==null){
                res.setRealCap(0f);
               /* res.setRealCap(0f);
                res.setTestStartTime(ThreadLocalUtil.parse("1972-01-01 00:00:00",1));
                res.setTestTimelong(0);
                res.setTestCap(0f);
                res.setStopReason("");
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId()));
                res.setDisChargeType(2);
                res.setDisChargeType(2);*/
                continue;
            }
            if(!groupName.equals("none")){
                BanZu bz= (BanZu) bzmap.get(groupName);
                int dischargeNum=bz.getDischargeNum();
                bz.setDischargeNum(dischargeNum+1);
                bzmap.put(groupName,bz);
            }
            res.setTestStartTime(tinf.getTestStarttime());
            res.setTestTimelong(tinf.getTestTimelong());
            res.setTestCap(tinf.getTestCap());
@@ -665,27 +680,27 @@
            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);
            res.setRealCap(grouprealCap);
            res.setDisChargeType(1);
            //res.setDisChargeType(1);
            if(grouprealCap>=moncapStd*badValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()));
                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId()),value+1);
            }
            if(grouprealCap<=moncapStd*damageValue){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()));
                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId()),value+1);
            }
            if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){
                res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                int value=xnmap.get(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()));
                xnmap.put(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId()),value+1);
            }
            if(stic.getDisChargeType()==null){
                reslist.add(res);
            }else{
                if(res.getDisChargeType()==stic.getDisChargeType()){
                    reslist.add(res);
                }
            }
        }
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"本年度已放电数量统计");
    }//本年度已放电数量统计右侧图表(1.2.5)
        return new Response().setIIII(1,reslist.size()>0,pageInfo,bzmap,xnmap,"本年度已放电数量统计");
    }//本年度已放电数量统计右侧图表(1.2.5/6)
    public Response getDischr5Chart(Integer uid) {
        //班组
        Map<String,  Object> bzmap=new HashMap<>();
@@ -774,6 +789,10 @@
    //本年度未放电数量统计(1.2.6)
    public Response getDischr6Statistic(DisChargeStic stic) {
        //班组
        Map<String,  Object> bzmap=new HashMap<>();
        //查询出所有的班组并赋予初始值
        setBanZuDefault(bzmap);
        //1查询符合条件的电池组
        List<BattInf> binfList=battInfService.getDischr6Statistic(stic);
        if(binfList==null||binfList.size()==0){
@@ -805,9 +824,19 @@
                    reslist.add(res);
                }
            }
            if(tinf==null){
                if(!groupName.equals("none")){
                    BanZu bz= (BanZu) bzmap.get(groupName);
                    int nochargeNum=bz.getNochargeNum();
                    bz.setNochargeNum(nochargeNum+1);
                    bzmap.put(groupName,bz);
                }
                continue;
            }
        }
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"本年度未放电数量统计");
        return new Response().setIII(1,reslist.size()>0,pageInfo,bzmap,"本年度未放电数量统计");
    }
    //2.获取电池组未放电记录(指定时间段的标准核容放电)
    private void getNoDischargeData(Integer battgroupId, Date testStartTime, Date testEndTime, List<Integer> typeList, SticDischarge6Res res) {
@@ -905,5 +934,27 @@
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"电池组电池性能统计(未放电,优秀,劣化,损坏)统计(1.2.8/9/10)");
    }
   //优良电源数量统计(1.2.7)
    public Response getPwr7Statistic(Pwr7Stic 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.getPwr7Statistic(stic);
        List<PerformanceRes> reslist=new ArrayList<>();
        PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize());
        return new Response().setII(1,reslist.size()>0,pageInfo,"优良电源数量统计(1.2.7)");
    }
}
src/main/resources/mapper/BattInfMapper.xml
@@ -418,4 +418,44 @@
            order by tb_batt_inf.dev_id asc,battgroup_id asc
        </where>
    </select>
    <select id="getPwr7Statistic" 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.monvolstd!=null">
                and tb_batt_inf.monvolstd=#{stic.monvolstd}
            </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>