whyclxw
2024-07-22 ff1ed10ebcb27f4039fb121486261c0b24208baf
src/main/java/com/whyc/service/BattTestInfService.java
@@ -11,13 +11,12 @@
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.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.*;
@@ -34,6 +33,10 @@
    @Autowired(required = false)
    private BattAlarmMapper alarmMapper;
    @Autowired(required = false)
    private SubTableService subTableService;
    //查询充放电记录
    public Response getTinfHis(int binfId, int pageNum, int pageSize) {
@@ -278,5 +281,31 @@
        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, "查询成功");
    }
}