| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.BattCapFactory; |
| | | import com.whyc.dto.ReportBattDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.AlarmParamMapper; |
| | | import com.whyc.mapper.BattAlarmMapper; |
| | | import com.whyc.mapper.BattInfMapper; |
| | | import com.whyc.mapper.BattTestInfMapper; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.PageInfoUtils; |
| | | import com.whyc.pojo.db_dis_batt.BattTestInf; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | |
| | | //查询充放电记录 |
| | | 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, Integer battGroupId) { |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<BattTestInf> list =mapper.getDischargeList(battGroupId); |
| | | 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); |
| | | } |
| | | |
| | | public BattTestInf getDischargeLast(int battGroupId) { |
| | | QueryWrapper<BattTestInf> query = Wrappers.query(); |
| | | //测试时长大于30分钟 |
| | | query.eq("binf_id", battGroupId); |
| | | query.eq("test_type",3); |
| | | query.ge("test_timelong",1800); |
| | | query.orderByDesc("record_time"); |
| | | query.last(" limit 1"); |
| | | return mapper.selectOne(query); |
| | | } |
| | | |
| | | public BattTestInf getDischargeRecord(int battGroupId, int testRecordCount) { |
| | | QueryWrapper<BattTestInf> query = Wrappers.query(); |
| | | query.eq("binf_id", battGroupId); |
| | | query.eq("test_record_count", testRecordCount); |
| | | //query.eq("test_type",3); |
| | | //query.ge("test_timelong",1800); |
| | | |
| | | query.last(" limit 1"); |
| | | return mapper.selectOne(query); |
| | | } |
| | | |
| | | /* |
| | | //1.4电池性能评估 |
| | | public Response searchGroupAssess(int pageNum, int pageSize, ReportBattDTO tinf, int userId){ |
| | | //List<BattInf> battinfList = binfMapper.searchGroupAssess(tinf, userId); |
| | |
| | | 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)) |
| | |
| | | return map; |
| | | } |
| | | //查询电池告警(2024。4.15修改) |
| | | */ |
| | | /*未放电:本年度未放电 |
| | | *优秀:本年度已放电,且容量健康,无内阻告警(预告警(重要),告警(紧急)) |
| | | *劣化:本年度未放电,内阻告警(预告警(重要),告警(紧急)) |
| | |
| | | * 容量小于劣化阈值,内阻正常 |
| | | * 容量正常,内阻告警(预告警,告警) |
| | | * 损坏:容量低,内阻告警 |
| | | * */ |
| | | * *//* |
| | | |
| | | private List getAlm2(Integer battGroupId) { |
| | | List list = alarmMapper.getAlm2(battGroupId); |
| | | return list; |
| | |
| | | if ((disNum > 0) && (realCap > capAlarm * monCapStd)) { |
| | | map.put("flag", 1); |
| | | } |
| | | /*劣化: |
| | | *容量小于劣化阈值,大于损坏阈值 |
| | | */ |
| | | */ |
| | | /*劣化: |
| | | *容量小于劣化阈值,大于损坏阈值 |
| | | *//* |
| | | |
| | | if (((disNum > 0) && (realCap <= capAlarm * monCapStd && realCap >= capChange * monCapStd))) { |
| | | map.put("flag", 2); |
| | | } |
| | |
| | | return new Response().set(1, map, "查询成功"); |
| | | } |
| | | |
| | | }*/ |
| | | } |