whycxzp
2025-04-14 8557f4a954278b76a3054ee1edbb93f656b533ba
src/main/java/com/whyc/service/BattTestInfService.java
@@ -11,13 +11,14 @@
import com.whyc.mapper.BattAlarmMapper;
import com.whyc.mapper.BattInfMapper;
import com.whyc.mapper.BattTestInfMapper;
import com.whyc.pojo.AlarmParam;
import com.whyc.pojo.BattAlarm;
import com.whyc.pojo.BattInf;
import com.whyc.pojo.BattTestInf;
import com.whyc.pojo.*;
import com.whyc.pojo.db_batt.BattInf;
import com.whyc.pojo.db_dis_batt.BattTestInf;
import com.whyc.util.ActionUtil;
import com.whyc.util.PageInfoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.*;
@@ -35,16 +36,36 @@
    @Autowired(required = false)
    private BattAlarmMapper alarmMapper;
    @Autowired(required = false)
    private SubTableService subTableService;
    //查询充放电记录
    public Response getTinfHis(int binfId, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        QueryWrapper wrapper= Wrappers.query();
        wrapper.eq("binf_id",binfId);
        List<BattTestInf> list=mapper.selectList(wrapper);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"查询充放电记录");
    public Response getPageByBattGroupId(int battGroupId, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        QueryWrapper wrapper = Wrappers.query();
        wrapper.eq("binf_id", battGroupId);
        List<BattTestInf> list = mapper.selectList(wrapper);
        PageInfo pageInfo = new PageInfo(list);
        return new Response().set(1, pageInfo);
    }
    public Response getDischargePage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<BattTestInf> list =mapper.getDischargeList();
        list.forEach(item->{
            //小时率
            int hourRate = BattCapFactory.GetHourRate(item.getMonCap(), item.getTestCurr());
            //容量计算
            Double realCap = BattCapFactory.GetMonomerCap(item.getMonCap(), hourRate, item.getTestCap(), item.getMaxMonvol(), item.getMinMonvol(), item.getMonVol(), BattCapFactory.CapType_Real);
            item.setRealCap(realCap.floatValue());
        });
        PageInfo pageInfo = new PageInfo(list);
        return new Response().set(1, pageInfo);
    }
    /*
    //1.4电池性能评估
    public Response searchGroupAssess(int pageNum, int pageSize, ReportBattDTO tinf, int userId){
        //List<BattInf> battinfList = binfMapper.searchGroupAssess(tinf, userId);
@@ -196,11 +217,13 @@
            map.put("flag",1);
        }
        /*劣化:本年度未放电,内阻告警(预告警(重要),告警(紧急))
         *容量小于劣化阈值,大于损坏阈值,内阻告警(预告警,告警)
         *     容量小于劣化阈值,内阻正常
         *     容量正常,内阻告警(预告警,告警)
         */
        */
    /*劣化:本年度未放电,内阻告警(预告警(重要),告警(紧急))
     *容量小于劣化阈值,大于损坏阈值,内阻告警(预告警,告警)
     *     容量小于劣化阈值,内阻正常
     *     容量正常,内阻告警(预告警,告警)
     *//*
        if (((disNum==0)&&(listALmRes.size()>0))
                ||((disNum>0)&&(realCap <= capAlarm * monCapStd && realCap >= capChange * monCapStd)&&(listALmRes.size()>0))
                ||((disNum>0)&&(realCap <= capAlarm * monCapStd)&&(listALmRes.size()<=0))
@@ -218,6 +241,7 @@
        return map;
    }
    //查询电池告警(2024。4.15修改)
    */
    /*未放电:本年度未放电
     *优秀:本年度已放电,且容量健康,无内阻告警(预告警(重要),告警(紧急))
     *劣化:本年度未放电,内阻告警(预告警(重要),告警(紧急))
@@ -225,7 +249,8 @@
     *     容量小于劣化阈值,内阻正常
     *     容量正常,内阻告警(预告警,告警)
     * 损坏:容量低,内阻告警
     * */
     * *//*
    private List getAlm2(Integer battGroupId) {
        List list = alarmMapper.getAlm2(battGroupId);
        return list;
@@ -265,9 +290,11 @@
        if ((disNum > 0) && (realCap > capAlarm * monCapStd)) {
            map.put("flag", 1);
        }
        /*劣化:
         *容量小于劣化阈值,大于损坏阈值
         */
        */
    /*劣化:
     *容量小于劣化阈值,大于损坏阈值
     *//*
        if (((disNum > 0) && (realCap <= capAlarm * monCapStd && realCap >= capChange * monCapStd))) {
            map.put("flag", 2);
        }
@@ -278,5 +305,32 @@
        return map;
    }
    //电池单体性能评估
    public Response searchMonNumAssess( int binfId,  int monNum) {
        //获取指定电池组信息
        QueryWrapper wrapper=Wrappers.query();
        wrapper.eq("binf_id",binfId);
        wrapper.last("limit 1");
        BattInf binf=binfMapper.selectOne(wrapper);
        Map<String, Object> map = new HashMap<>();
        //获取有效的放电记录
        List<BattTestInf> list=mapper.searchDischarge(binfId);
        float cap = 0f;//实际容量
        //取最近一笔数据
        BattTestInf  tinf=list.stream().findFirst().orElse((BattTestInf) ActionUtil.objeNull);
        if(tinf!=null){
            int hourRate = BattCapFactory.GetHourRate(binf.getMonCap(), tinf.getTestCurr());
            //取该单体最后一笔放电记录
            BattTestInfData tData=subTableService.getMonNumData(binfId,tinf.getTestRecordCount(),tinf.getRecordNum(),monNum);
            if(tData!=null){
                cap = (float) BattCapFactory.GetMonomerCap(binf.getMonCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tData.getMonVol(), binf.getMonVol(), BattCapFactory.CapType_Real);
            }
           }
        map.put("cap",cap);
        //评估单体
        return new Response().set(1, map, "查询成功");
    }
    }*/
}