whyclxw
2025-06-10 2a0d63149431539aae2abf67b1302c9041220796
实时推送修改
4个文件已修改
87 ■■■■■ 已修改文件
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/webSocket/RealTimeSocket.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BatttestdataInfMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java
@@ -4,9 +4,13 @@
import com.whyc.pojo.db_batt_testdata.BatttestdataInf;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface BatttestdataInfMapper extends CustomMapper<BatttestdataInf>{
    //蓄电池核容信息统计
    List<BatttestdataInf> getBattTinfStatistic(@Param("stic") BattTinfStic stic);
    //获取电池组未放电记录(指定时间段的标准核容放电)
    List<BatttestdataInf> getNoDischargeData(@Param("battgroupId") Integer battgroupId,@Param("testStartTime") Date testStartTime
            , @Param("testEndTime") Date testEndTime, @Param("typeList") List<Integer> typeList);
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -722,7 +722,7 @@
            return new Response().set(1,false,"当前用户未管理满足条件的电池组");
        }
        List<SticDischarge6Res> reslist=new ArrayList<>();
        /*for (BattInf binf:binfList) {
        for (BattInf binf:binfList) {
            //查询电池组所在的班组
            String  groupName=bjService.getGroupName(binf.getPowerId());
            SticDischarge6Res res=new SticDischarge6Res();
@@ -731,16 +731,11 @@
            res.setCountry(binf.getCountry());
            res.setStationName(binf.getStationName());
            res.setBattgroupName(binf.getBattgroupName());
            //2.获取电池组未放电记录(指定时间段的标准核容放电)
            //获取电池组未放电记录(指定时间段的标准核容放电)
            getNoDischargeData(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime(),stic.getTypeList(),res);
            //2.获取电池组在给定时间段的放电记录(指定时间段的标准核容放电)
            BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime());
            if(tinf==null){
                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);
                if(!groupName.equals("none")){
                    BanZu bz= (BanZu) map.get(groupName);
                    int nochargeNum=bz.getNochargeNum();
@@ -755,33 +750,18 @@
                bz.setDischargeNum(dischargeNum+1);
                map.put(groupName,bz);
            }
            res.setTestStartTime(tinf.getTestStarttime());
            res.setTestTimelong(tinf.getTestTimelong());
            res.setTestCap(tinf.getTestCap());
            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);
            res.setRealCap(grouprealCap);
            res.setDisChargeType(1);
            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()));
            }
            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,"本年度未放电数量统计");
    }
    //2.获取电池组未放电记录(指定时间段的标准核容放电)
    private void getNoDischargeData(Integer battgroupId, Date testStartTime, Date testEndTime, List<Integer> typeList, SticDischarge6Res res) {
        List<BatttestdataInf> tinfList=mapper.getNoDischargeData(battgroupId,testStartTime,testEndTime,typeList);
        if(tinfList!=null&&tinfList.size()>0){
            res.setErrorNum(tinfList.size());
        }else {
            res.setErrorNum(0);
            res.setStopList(new ArrayList<>());
        }
    }
}
src/main/java/com/whyc/webSocket/RealTimeSocket.java
@@ -498,7 +498,19 @@
        List<Integer> maxResNumList = new ArrayList<>();
        List<Integer> minResNumList = new ArrayList<>();
          //计算集合中单体电压,内阻,温度,容量的最大最小值
        for (BattRtdata rtdata:battRtdataList) {
        for (int i=0;i<battRtdataList.size();i++) {
            BattRtdata rtdata=battRtdataList.get(i);
            if(i==0){
                //赋值初始值
                maxVol = rtdata.getMonVol();
                minVol = rtdata.getMonVol();
                maxTmp = rtdata.getMonTmp();
                minTmp = rtdata.getMonTmp();
                maxRes = rtdata.getMonRes();
                minRes = rtdata.getMonRes();
                maxCap = rtdata.getMonCap();
                minCap = rtdata.getMonCap();
            }
            if(rtdata.getMonVol()>=maxVol){
                maxVol = rtdata.getMonVol();
            }
src/main/resources/mapper/BatttestdataInfMapper.xml
@@ -41,4 +41,23 @@
        </where>
        order by tb_batttestdata_inf.battgroup_id asc, tb_batttestdata_inf.test_record_count asc
    </select>
    <select id="getNoDischargeData" resultType="com.whyc.pojo.db_batt_testdata.BatttestdataInf">
        select * from db_batt_testdata.tb_batttestdata_inf
        <where>
            battgroup_id=#{battgroupId} and test_type=3
            and (test_starttype!=3 or test_timelong &lt;7200)
            <if test="stic.testStartTime!=null">
                and tb_batttestdata_inf.test_starttime>=#{stic.testStartTime}
            </if>
            <if test="stic.testEndTime!=null">
                and tb_batttestdata_inf.test_starttime&lt;=#{stic.testEndTime}
            </if>
            <if test="typeList!=null">
                and test_stoptype in
                <foreach item="item" index="index" collection="typeList" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>
</mapper>