src/main/java/com/whyc/controller/BattCompareController.java
@@ -3,15 +3,16 @@ import com.whyc.dto.Response; import com.whyc.dto.Statistic.BattCompareStic; import com.whyc.pojo.db_user.User; import com.whyc.service.BattresdataInfService; import com.whyc.service.BatttestdataInfService; import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import java.text.ParseException; import java.util.Map; @RestController @Api(tags = "蓄电池对比分析管理") @@ -21,28 +22,38 @@ @Autowired private BatttestdataInfService battTinfService; @Autowired private BattresdataInfService battRinfService; @ApiOperation(value = "蓄电池组对比分析界面(同一品牌同一时间)(1.2.15)") @ApiOperation(value = "蓄电池组对比分析界面(同一时间同一品牌/同一时间不同一品牌/不同一时间同一品牌)(1.2.15/16/17)") @PostMapping("getBattCompare15Statistic") public Response getBattCompare15Statistic(@RequestBody BattCompareStic stic){ public Response getBattCompare15Statistic(@RequestBody BattCompareStic stic) throws ParseException { User uinf= ActionUtil.getUser(); stic.setUid(uinf.getId()); if(stic.getInuserYear()!=null){ int year=ActionUtil.getNowYear(); stic.setInuseStartTime(ActionUtil.sdfwithday.parse(ActionUtil.getDayTime(year+1-stic.getInuserYear(),0,1,5))); stic.setInuseEndTime(ActionUtil.sdfwithday.parse(ActionUtil.getDayTime(year,11,31,5))); } return battTinfService.getBattCompare15Statistic(stic); } @ApiOperation(value = "蓄电池组对比分析界面(不同品牌同一时间)(1.2.16)") @PostMapping("getBattCompare16Statistic") public Response getBattCompare16Statistic(@RequestBody BattCompareStic stic){ User uinf= ActionUtil.getUser(); stic.setUid(uinf.getId()); return battTinfService.getBattCompare16Statistic(stic); @ApiOperation(value = "点击右侧折线图画出电池组所有完整周期的实际容量变化图(1.2.15/16/17)") @GetMapping("getRealCapChangeByBattgroupId") public Response getRealCapChangeByBattgroupId(@RequestParam Integer battgroupId){ return battTinfService.getRealCapChangeByBattgroupId(battgroupId); } @ApiOperation(value = "蓄电池组对比分析界面(同一品牌不同时间)(1.2.17)") @PostMapping("getBattCompare17Statistic") public Response getBattCompare17Statistic(@RequestBody BattCompareStic stic){ User uinf= ActionUtil.getUser(); stic.setUid(uinf.getId()); return battTinfService.getBattCompare17Statistic(stic); @ApiOperation(value = "点击右侧折线图画出电池组所有完整周期的浮充电压变化图(1.2.15/16/17)") @GetMapping("getFloatGroupVolChangeByBattgroupId") public Response getFloatGroupVolChangeByBattgroupId(@RequestParam Integer battgroupId){ return battTinfService.getFloatGroupVolChangeByBattgroupId(battgroupId); } @ApiOperation(value = "点击右侧折线图画出电池组单体的所有内阻测试单体内阻变化图(1.2.15/16/17)") @GetMapping("getMonResChangeByBattgroupId") public Response getMonResChangeByBattgroupId(@RequestParam Integer battgroupId,@RequestParam Integer monNum){ return battRinfService.getMonResChangeByBattgroupId(battgroupId,monNum); } } src/main/java/com/whyc/controller/StatisticController.java
@@ -128,7 +128,7 @@ stic.setUid(uinf.getId()); return battTinfService.getBattTinfStatistic(stic); } @ApiOperation(value = "蓄电池组对比分析界面(同一品牌同一时间)(1.2.15)") /* @ApiOperation(value = "蓄电池组对比分析界面(同一品牌同一时间)(1.2.15)") @PostMapping("getBattCompare15Statistic") public Response getBattCompare15Statistic(@RequestBody BattCompareStic stic){ User uinf= ActionUtil.getUser(); @@ -150,7 +150,7 @@ User uinf= ActionUtil.getUser(); stic.setUid(uinf.getId()); return battTinfService.getBattCompare17Statistic(stic); } }*/ @ApiOperation(value = "设备工作状态统计(1.2.21)") @PostMapping("getDeviceStateStatistic") src/main/java/com/whyc/dto/Statistic/BattCompareStic.java
@@ -15,15 +15,17 @@ private Integer pageNum; private Integer pageSize; private Integer performance;//电池性能:1优秀,2劣化,3损坏 4未放电 不传全部 private String product; private String product; //品牌 private Float moncapstd;//标称容量 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date testStartTime;//开始时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date testEndTime;//结束时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd") private Date inuseStartTime;//开始时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd") private Date inuseEndTime;//结束时间 private Integer inuserYear;//投运时间1~15年 } src/main/java/com/whyc/dto/Statistic/ComPareChangeCurve.java
New file @@ -0,0 +1,13 @@ package com.whyc.dto.Statistic; import lombok.Data; import java.util.Date; @Data public class ComPareChangeCurve { private Integer battgroupId; private Date startTime; private Float curveValue; private Integer monNum; } src/main/java/com/whyc/dto/Statistic/ComPareChart.java
New file @@ -0,0 +1,11 @@ package com.whyc.dto.Statistic; import lombok.Data; @Data public class ComPareChart { private Integer battgroupId; private String battgroupName; private Float value; private Integer monNum;//最高单体内阻有用 } src/main/java/com/whyc/dto/Statistic/SticCompare15Res.java
@@ -19,7 +19,7 @@ @JsonFormat(pattern = "yyyy-MM-dd") private Date inuseTime; private Float monvolstd; private List<Integer> monNums; //损坏单体编号 //private List<Integer> monNums; //损坏单体编号 private Float realCap; //实际容量 private String precentCap; //容量百分比 private String capperformance; //性能 @@ -27,4 +27,6 @@ private Integer powerId; private Integer devId; private Integer battgroupId; private String stopReason;//停止原因 private Float floatGroupVol;//浮充电压(放电开始前的组端电压)--电源浮充电压 } src/main/java/com/whyc/service/AlmAnalysisParamService.java
@@ -234,10 +234,10 @@ //将属性拷贝至almAnalysisParam中 copyProperties(almAnalysisParam,res); //分组查看需要查询电源/电池实时表的哪些数据 Map<String, Map<String,Object>> groupmap=groupPwrAndBatt(almAnalysisParam); Map<String, Map<String,Object>> groupmap=groupPwrAndBattWithChage(almAnalysisParam); Map<String,Object> battMap=groupmap.get("batt"); Map<String,Object> pwrMap=groupmap.get("pwr"); Map<String,Object> mainMap=groupmap.get("main"); Map<String,Object> mainMap=new HashMap<>(); mainMap.put("pwr",pwrMap.size()); mainMap.put("batt",battMap.size()); if(res.getBattgroupId()!=null){ @@ -254,18 +254,78 @@ } return new Response().setIIII(1,true, map,mainMap,almAnalysisParam,"预警分析管理-切换时间间隔和副属性"); } //分组查看需要查询电源/电池实时表的哪些数据 private Map<String, Map<String, Object>> groupPwrAndBattWithChage(AlmAnalysisParam almAnalysisParam) { Map<String, Map<String,Object>> map = new HashMap<>(); Map<String,Object> battMap=new HashMap<>(); Map<String,Object> pwrMap=new HashMap<>(); if(almAnalysisParam.getMinorField1Type()==1||almAnalysisParam.getMinorField1Type()==2||almAnalysisParam.getMinorField1Type()==3){ if(almAnalysisParam.getMinorField1()!=null&&almAnalysisParam.getMinorField1().length()>0){ pwrMap.put(almAnalysisParam.getMinorField1(),almAnalysisParam.getMinorField1Type()); } }else{ if(almAnalysisParam.getMinorField1()!=null&&almAnalysisParam.getMinorField1().length()>0){ battMap.put(almAnalysisParam.getMinorField1(),almAnalysisParam.getMinorField1Type()); } } if(almAnalysisParam.getMinorField2Type()==1||almAnalysisParam.getMinorField2Type()==2||almAnalysisParam.getMinorField2Type()==3){ if(almAnalysisParam.getMinorField2()!=null&&almAnalysisParam.getMinorField2().length()>0){ pwrMap.put(almAnalysisParam.getMinorField2(),almAnalysisParam.getMinorField2Type()); } }else{ if(almAnalysisParam.getMinorField2()!=null&&almAnalysisParam.getMinorField2().length()>0){ battMap.put(almAnalysisParam.getMinorField2(),almAnalysisParam.getMinorField2Type()); } } if(almAnalysisParam.getMinorField3Type()==1||almAnalysisParam.getMinorField3Type()==2||almAnalysisParam.getMinorField3Type()==3){ if(almAnalysisParam.getMinorField3()!=null&&almAnalysisParam.getMinorField3().length()>0){ pwrMap.put(almAnalysisParam.getMinorField3(),almAnalysisParam.getMinorField3Type()); } }else{ if(almAnalysisParam.getMinorField3()!=null&&almAnalysisParam.getMinorField3().length()>0){ battMap.put(almAnalysisParam.getMinorField3(),almAnalysisParam.getMinorField3Type()); } } if(almAnalysisParam.getMinorField4Type()==1||almAnalysisParam.getMinorField4Type()==2||almAnalysisParam.getMinorField4Type()==3){ if(almAnalysisParam.getMinorField4()!=null&&almAnalysisParam.getMinorField4().length()>0){ pwrMap.put(almAnalysisParam.getMinorField4(),almAnalysisParam.getMinorField4Type()); } }else{ if(almAnalysisParam.getMinorField4()!=null&&almAnalysisParam.getMinorField4().length()>0){ battMap.put(almAnalysisParam.getMinorField4(),almAnalysisParam.getMinorField4Type()); } } map.put("pwr",pwrMap); map.put("batt",battMap); return map; } //将属性拷贝至almAnalysisParam中 private void copyProperties(AlmAnalysisParam almAnalysisParam, AnalysisChangeRes res) { almAnalysisParam.setMainField(res.getDataName1()); almAnalysisParam.setMainFieldType(res.getDataType1()); almAnalysisParam.setMinorField1(res.getDataName2()); almAnalysisParam.setMinorField1Type(res.getDataType2()); almAnalysisParam.setMinorField2(res.getDataName3()); almAnalysisParam.setMinorField2Type(res.getDataType3()); almAnalysisParam.setMinorField3(res.getDataName4()); almAnalysisParam.setMinorField3Type(res.getDataType4()); almAnalysisParam.setMinorField4(res.getDataName5()); almAnalysisParam.setMinorField4Type(res.getDataType5()); almAnalysisParam.setMinorField1(res.getDataName1()); if(res.getDataType1()!=null){ almAnalysisParam.setMinorField1Type(res.getDataType1()); }else{ almAnalysisParam.setMinorField1Type(0); } almAnalysisParam.setMinorField2(res.getDataName2()); if(res.getDataType2()!=null){ almAnalysisParam.setMinorField2Type(res.getDataType2()); }else{ almAnalysisParam.setMinorField2Type(0); } almAnalysisParam.setMinorField3(res.getDataName3()); if(res.getDataType3()!=null){ almAnalysisParam.setMinorField3Type(res.getDataType3()); }else{ almAnalysisParam.setMinorField3Type(0); } almAnalysisParam.setMinorField4(res.getDataName4()); if(res.getDataType4()!=null){ almAnalysisParam.setMinorField4Type(res.getDataType4()); }else{ almAnalysisParam.setMinorField4Type(0); } } //预警分析管理-查询所有的属性对应关系 public Response getAlmSummaryParam() { src/main/java/com/whyc/service/BattresdataInfService.java
@@ -2,15 +2,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.whyc.dto.Real.QuarterDto; import com.whyc.dto.Response; import com.whyc.dto.Statistic.ComPareChangeCurve; import com.whyc.dto.Statistic.ComPareChart; import com.whyc.mapper.BattresdataInfMapper; import com.whyc.mapper.CommonMapper; import com.whyc.pojo.db_batt_testdata.BattresdataId; import com.whyc.pojo.db_batt_testdata.BattresdataInf; import com.whyc.pojo.db_station.BattInf; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.*; @Service public class BattresdataInfService { @@ -40,7 +44,6 @@ wrapper.last(" ORDER BY test_record_count asc "); BattresdataInf rinf = mapper.selectOne(wrapper); if(rinf!=null){ String tableName ="db_batt_testdata.tb_battresdata_"+battgroupId; String existTableName = commonMapper.existTable("db_batt_testdata", "tb_battresdata_"+battgroupId); if(existTableName != null){ List<QuarterDto> list=subTablePageInfoService.getBattResInfData(battgroupId,rinf.getTestRecordCount()); @@ -49,4 +52,60 @@ } return null; } //蓄电池对比分析右侧最高单体内阻数据(最新一次内阻测试) public ComPareChart getMaxResData(BattInf binf) { QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("battgroup_id", binf.getBattgroupId()); wrapper.last(" limit 1"); wrapper.last(" ORDER BY test_starttime desc "); BattresdataInf rinf = mapper.selectOne(wrapper); ComPareChart chart=new ComPareChart(); chart.setBattgroupName(binf.getBattgroupName()); chart.setBattgroupId(binf.getBattgroupId()); chart.setValue(0f); chart.setMonNum(1); if(rinf!=null){ String existTableName = commonMapper.existTable("db_batt_testdata", "tb_battresdata_"+binf.getBattgroupId()); if(existTableName != null){ //取内阻测试的最大内阻和单体编号 List<QuarterDto> list=subTablePageInfoService.getMaxResInInfData(binf.getBattgroupId(),rinf.getTestRecordCount()); if(list!=null&&list.size()>0){ Map<String, Object> map =list.stream() .max(Comparator.comparing(QuarterDto::getNumValue)) .map(dto -> { Map<String, Object> result = new HashMap<>(); result.put("maxNumValue", dto.getNumValue()); result.put("monNum", dto.getMonNum()); return result; }) .orElse(Collections.emptyMap()); chart.setBattgroupId(binf.getBattgroupId()); chart.setBattgroupName(binf.getBattgroupName()); chart.setValue(Float.parseFloat(map.get("maxNumValue").toString())); chart.setMonNum(Integer.parseInt(map.get("monNum").toString())); } } } return chart; } //点击右侧折线图画出电池组单体的所有内阻测试单体内阻变化图(1.2.15/16/17) public Response getMonResChangeByBattgroupId(Integer battgroupId, Integer monNum) { QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("battgroup_id", battgroupId); wrapper.last(" ORDER BY test_starttime asc "); List<BattresdataInf> list = mapper.selectList(wrapper); List<ComPareChangeCurve> curvelist=new ArrayList<>(); for (BattresdataInf rinf:list) { String existTableName = commonMapper.existTable("db_batt_testdata", "tb_battresdata_"+battgroupId); if(existTableName != null){ //取内阻测试指定单体的单体电压 ComPareChangeCurve curve=subTablePageInfoService.getMonResChangeByBattgroupId(battgroupId,rinf.getTestRecordCount(),monNum); if(curve!=null){ curvelist.add(curve); } } } return new Response().setII(1,list.size()>0,curvelist,"点击右侧折线图画出电池组单体的所有内阻测试单体内阻变化图(1.2.15/16/17)"); } } src/main/java/com/whyc/service/BatttestdataIdService.java
@@ -45,8 +45,8 @@ BatttestdataInf tinf=tinfService.getTinfByTestRecordCount(battgroupId,testRecordCount); int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); for (BatttestdataId data:list) { Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real); Float restcap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); Float realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real); Float restcap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); data.setRealCap(realCap); data.setRestCap(restcap); data.setPercentCap(String.format("%.5f",(realCap/binf.getMoncapstd()*100))); src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -57,11 +57,14 @@ @Autowired(required = false) private PwrdevHistorydataIdService pwrHisdataIdService; @Autowired(required = false) private BattresdataInfService battResdataInfService; //获取最后一次测试数据并计算剩余容量 public Float getLastTestDataRestCap(Integer battgroupId) { public Float getLastTestDataRestCap(Float moncapstd,Integer battgroupId) { //获取放电记录 QueryWrapper wrapper=new QueryWrapper(); wrapper.eq("battgroup_id",battgroupId); @@ -70,7 +73,7 @@ BatttestdataInf tinf=mapper.selectOne(wrapper); if(tinf!=null){ int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); Float restcap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); Float restcap = (float) BattCapFactory.GetMonomerCap(moncapstd, hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); return restcap; }else{ return 0f; @@ -82,17 +85,18 @@ List<BatttestdataInf> list=mapper.getBattTinfStatistic(stic); if(list!=null&&list.size()>0){ for (BatttestdataInf tinf:list) { //获取电池组信息 BattInf binf=battInfService.getBinfByBattgroupId(tinf.getBattgroupId()); //剩余容量和剩余时间计算 int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); Float restCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); Float realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); tinf.setRestCap(restCap); tinf.setRealCap(realCap); tinf.setRestTime(0f); //获取电池组实时数据 BattRtstate battRtstate=rtstateService.getBattRealInfo(tinf.getBattgroupId()); //获取电池组信息 BattInf binf=battInfService.getBinfByBattgroupId(tinf.getBattgroupId()); //实时组端电流,剩余容量,标称容量 if(battRtstate!=null){ Float restTime= BattCapFactory.getTheoryTime(battRtstate.getLoadCurr(), restCap, binf.getMoncapstd()); @@ -193,7 +197,7 @@ int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); Float moncapStd=binf.getMoncapstd(); for (BatttestdataId data:idDataList) {//求单体的 实际容量,最小值就是单体的单体电压 realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real); realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real); SticMonRes res=new SticMonRes(); res.setBattgroupId(binf.getBattgroupId()); res.setBattgroupName(binf.getBattgroupName()); @@ -260,8 +264,8 @@ } } /*蓄电池组对比分析界面(同一品牌同一时间) *1.查询出符合条件的电池组信息 * 2.计算电池组的预估剩余容量 *1.查询出符合条件的电池组信息(同一品牌同一投运时间) * 2.计算电池组的最近一次标准核容放电的预估容量 *3.判断性能和百分比 * 4.分页 */ @@ -280,12 +284,25 @@ } } } Map<String,Object> map=new HashMap<>();//右侧图表 map.put("avgCap",0f); map.put("standCapDiff",0f); Float sumCap=0f; Float maxCap=0f; Float minCap=0f; Float standCapDiff=0f; List<ComPareChart> capList=new ArrayList<>(); List<ComPareChart> resList=new ArrayList<>(); List<ComPareChart> flotVolList=new ArrayList<>(); map.put("capList",capList); map.put("resList",resList); map.put("flotVolList",flotVolList); //1查询符合条件的电池组 List<BattInf> binfList=battInfService.getBattCompare15Statistic(stic); if(binfList==null||binfList.size()==0){ return new Response().set(1,false,"当前用户未管理满足条件的电池组"); } List<SticCompare15Res> reslist=new ArrayList<>(); List<SticCompare15Res> comparelist=new ArrayList<>(); for (BattInf binf:binfList) { SticCompare15Res res=new SticCompare15Res(); res.setProvice(binf.getProvice()); @@ -305,54 +322,73 @@ BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); if(tinf==null){ res.setRealCap(0f); res.setPrecentCap("0"); res.setPrecentCap("0.00000"); res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId())); continue; } //找这次放电的最后一笔数据 List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum()); if(idDataList==null||idDataList.size()==0){ res.setRealCap(0f); res.setPrecentCap("0"); res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId())); continue; } 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); //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); res.setRealCap(grouprealCap); if(grouprealCap>=moncapStd*badValue){ res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); } if(grouprealCap<=moncapStd*damageValue){ res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); } if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); } //保留5位小数 String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100)); res.setPrecentCap(precentCap); List<Integer> monNums=new ArrayList<>(); for (BatttestdataId data:idDataList) {//求单体的 实际容量,最小值就是单体的单体电压 Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); if (monrealCap <= moncapStd * damageValue) {//损坏的 monNums.add(data.getMonNum()); res.setStopReason("--"); res.setFloatGroupVol(0f); }else{ res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype())); res.setFloatGroupVol(tinf.getFloatGroupVol()); //找这次放电的最后一笔数据 List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum()); if(idDataList==null||idDataList.size()==0){ res.setRealCap(0f); res.setPrecentCap("0.00000"); res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_4.getStateId())); res.setFloatGroupVol(0f); }else{ Float moncapStd=binf.getMoncapstd(); int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); //Float restCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); res.setRealCap(grouprealCap); if(grouprealCap>=moncapStd*badValue){ res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); } if(grouprealCap<=moncapStd*damageValue){ res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_3.getStateId())); } if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_2.getStateId())); } //保留5位小数 String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100)); res.setPrecentCap(precentCap); sumCap+=grouprealCap; if(grouprealCap>=maxCap){ maxCap=grouprealCap; } if(grouprealCap<=minCap){ minCap=grouprealCap; } } } res.setMonNums(monNums); if(stic.getPerformance()==null){ reslist.add(res); comparelist.add(res); }else{ if(res.getCapperformance().equals(BattCapperformanceEnum.getValue(stic.getPerformance()))){ reslist.add(res); comparelist.add(res); } } ComPareChart capChart=new ComPareChart(); capChart.setBattgroupId(binf.getBattgroupId()); capChart.setBattgroupName(binf.getBattgroupName()); capChart.setValue(res.getRealCap()); capList.add(capChart); ComPareChart floatVolChart=new ComPareChart(); floatVolChart.setBattgroupId(binf.getBattgroupId()); floatVolChart.setBattgroupName(binf.getBattgroupName()); floatVolChart.setValue(res.getFloatGroupVol()); flotVolList.add(floatVolChart); //统计内阻测试 ComPareChart resChart=battResdataInfService.getMaxResData(binf); resList.add(resChart); } PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); return new Response().setII(1,reslist.size()>0,pageInfo,"蓄电池组对比分析界面(同一品牌同一时间)"); map.put("avgCap",sumCap/binfList.size()); map.put("standCapDiff",maxCap-minCap); PageInfo pageInfo=PageInfoUtils.list2PageInfo(comparelist, stic.getPageNum(), stic.getPageSize()); return new Response().setIII(1,comparelist.size()>0,pageInfo,map,"蓄电池组对比分析界面(同一品牌同一时间)"); } //蓄电池组对比分析界面(不同品牌同一时间)(1.2.16) @@ -406,8 +442,8 @@ 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); //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); //Float restCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); res.setRealCap(grouprealCap); if(grouprealCap>=moncapStd*badValue){ res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); @@ -491,7 +527,7 @@ res.setPowerId(binf.getPowerId()); res.setDevId(binf.getDevId()); res.setBattgroupId(binf.getBattgroupId()); Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); Float monrealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); res.setMonrealCap(monrealCap); //保留5位小数 String monprecentCap = String.format("%.5f",(monrealCap/binf.getMoncapstd()*100)); @@ -572,16 +608,16 @@ dto.setRecordNum(tinf.getRecordNum()); dto.setTestCap(tinf.getTestCap()); dto.setTestTimeLong(tinf.getTestTimelong()); int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); dto.setRealCap(realCap); //实时获取电池组信息 BattRtstate battRtstate = rtstateService.getBattRealInfo(tinf.getBattgroupId()); //获取电池组信息 BattInf binf = battInfService.getBinfByBattgroupId(tinf.getBattgroupId()); dto.setMoncapstd(binf.getMoncapstd()); dto.setMonCount(binf.getMoncount()); dto.setMonvolstd(binf.getMonvolstd()); int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); Float realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); dto.setRealCap(realCap); //实时获取电池组信息 BattRtstate battRtstate = rtstateService.getBattRealInfo(tinf.getBattgroupId()); dto.setFloatchartVol(tinf.getFloatGroupVol()); if(battRtstate!=null){ Float restTime= BattCapFactory.getTheoryTime(battRtstate.getLoadCurr(), realCap, binf.getMoncapstd()); @@ -693,7 +729,7 @@ res.setTestRecordCount(tinf.getTestRecordCount()); 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); Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); res.setRealCap(grouprealCap); //res.setDisChargeType(1); if(grouprealCap>=moncapStd*badValue){ @@ -869,7 +905,7 @@ }else{ 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); Float grouprealCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); res.setRealCap(grouprealCap); if(grouprealCap>=moncapStd*badValue){ res.setCapperformance(BattCapperformanceEnum.getValue(BattCapperformanceEnum.BATTSTATE_1.getStateId())); @@ -1012,4 +1048,46 @@ wrapper.last(" limit 1"); return mapper.selectOne(wrapper); } //点击右侧折线图画出电池组所有完整周期的实际容量变化图(1.2.15/16/17) public Response getRealCapChangeByBattgroupId(Integer battgroupId) { QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("battgroup_id", battgroupId); wrapper.eq("test_type", 3); wrapper.eq("test_starttype", 3); wrapper.eq("data_available", 1);//一次有效的记录 wrapper.last(" ORDER BY test_starttime DESC "); List<BatttestdataInf> list = mapper.selectList(wrapper); //获取电池组的标称容量 BattInf binf=battInfService.getBattgroupIdInf(battgroupId); List<ComPareChangeCurve> curvelist=new ArrayList<>(); for (BatttestdataInf tinf:list) { int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); Float realCap = (float) BattCapFactory.GetMonomerCap(binf.getMoncapstd(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); ComPareChangeCurve curve=new ComPareChangeCurve(); curve.setBattgroupId(battgroupId); curve.setStartTime(tinf.getTestStarttime()); curve.setCurveValue(realCap); curvelist.add(curve); } return new Response().setII(1,list.size()>0,curvelist,"点击右侧折线图画出电池组所有完整周期的实际容量变化图(1.2.15/16/17)"); } //点击右侧折线图画出电池组所有完整周期的浮充电压变化图(1.2.15/16/17) public Response getFloatGroupVolChangeByBattgroupId(Integer battgroupId) { QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("battgroup_id", battgroupId); wrapper.eq("test_type", 3); wrapper.eq("test_starttype", 3); wrapper.eq("data_available", 1);//一次有效的记录 wrapper.last(" ORDER BY test_starttime asc "); List<BatttestdataInf> list = mapper.selectList(wrapper); List<ComPareChangeCurve> curvelist=new ArrayList<>(); for (BatttestdataInf tinf:list) { ComPareChangeCurve curve=new ComPareChangeCurve(); curve.setBattgroupId(battgroupId); curve.setStartTime(tinf.getTestStarttime()); curve.setCurveValue(tinf.getFloatGroupVol()); curvelist.add(curve); } return new Response().setII(1,list.size()>0,curvelist,"点击右侧折线图画出电池组所有完整周期的浮充电压变化图(1.2.15/16/17)"); } } src/main/java/com/whyc/service/LeaderHomeService.java
@@ -1167,7 +1167,7 @@ } Float moncapStd = battInf.getMoncapstd(); int hourRate = BattCapFactory.GetHourRate(testInf.getTestCap(), testInf.getTestCurr()); Float groupRealCap = (float) BattCapFactory.GetMonomerCap(testInf.getTestCap(), hourRate, testInf.getTestCap(), testInf.getMaxMonvol(), testInf.getMinMonvol(), testInf.getGroupVol(), BattCapFactory.CapType_Real); Float groupRealCap = (float) BattCapFactory.GetMonomerCap(battInf.getMoncapstd(), hourRate, testInf.getTestCap(), testInf.getMaxMonvol(), testInf.getMinMonvol(), testInf.getGroupVol(), BattCapFactory.CapType_Real); capInfo.setRealCap(groupRealCap); if (groupRealCap >= moncapStd * badValue) { capInfo.setPerformance(BattCapperformanceEnum.BATTSTATE_1.getStateName()); src/main/java/com/whyc/service/SubTablePageInfoService.java
@@ -5,6 +5,8 @@ import com.whyc.dto.AlmHis.PwrAlmPar; import com.whyc.dto.AnalysisAlm.ResAnalysis; import com.whyc.dto.Real.*; import com.whyc.dto.Statistic.ComPareChangeCurve; import com.whyc.dto.Statistic.ComPareChart; import com.whyc.dto.Statistic.QuarterPwr7Res; import com.whyc.mapper.CallBack; import com.whyc.pojo.db_alarm.BattalarmDataHistory; @@ -518,7 +520,7 @@ } //获取内阻数据 public List<QuarterDto> getBattResInfData(Integer battgroupId,Integer testRecordCount) { String sql="select distinct mon_num,test_starttime,mon_res, from db_batt_testdata.tb_battresdata_"+battgroupId String sql="select distinct mon_num,test_starttime,mon_res from db_batt_testdata.tb_battresdata_"+battgroupId +" where test_record_count="+testRecordCount+" order by mon_num asc"; List<QuarterDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { @Override @@ -536,6 +538,50 @@ }); return list; } //取内阻测试的最大内阻和单体编号 public List<QuarterDto> getMaxResInInfData(Integer battgroupId, Integer testRecordCount) { String sql="select distinct mon_num,test_starttime,mon_res from db_batt_testdata.tb_battresdata_"+battgroupId +" where test_record_count="+testRecordCount+" order by mon_num asc"; List<QuarterDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { @Override public List getResults(ResultSet rs) throws SQLException { List<QuarterDto> list=new ArrayList<>(); while (rs.next()){ QuarterDto data=new QuarterDto(); data.setMonNum(rs.getInt("mon_num")); data.setNumValue(rs.getFloat("mon_res")); data.setRecordTime(rs.getTimestamp("test_starttime")); list.add(data); } return list; } }); return list; } //取内阻测试指定单体的单体电压 public ComPareChangeCurve getMonResChangeByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer monNum) { String sql="select distinct battgroup_id,mon_num,test_starttime,mon_res from db_batt_testdata.tb_battresdata_"+battgroupId +" where test_record_count="+testRecordCount+" and monNum="+monNum; List<ComPareChangeCurve> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { @Override public List getResults(ResultSet rs) throws SQLException { List<ComPareChangeCurve> list=new ArrayList<>(); while (rs.next()){ ComPareChangeCurve data=new ComPareChangeCurve(); data.setMonNum(rs.getInt("mon_num")); data.setCurveValue(rs.getFloat("mon_res")); data.setStartTime(rs.getTimestamp("test_starttime")); data.setBattgroupId(rs.getInt("battgroup_id")); list.add(data); } return list; } }); if(list!=null&&list.size()>0){ return list.get(0); } return null; } //找这次放电的指定一笔数据 public List<BatttestdataId> getLastDataByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer recordNum) { String sql="select distinct * from db_batt_testdata.tb_batttestdata_"+battgroupId src/main/java/com/whyc/util/ActionUtil.java
@@ -18,6 +18,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.YearMonth; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.regex.Matcher; @@ -340,7 +341,6 @@ cal.set(Calendar.DAY_OF_MONTH,day); if(type==1){ return new SimpleDateFormat( "yyyy-MM-dd ").format(cal.getTime())+"00:00:00"; } else if(type==2){ return new SimpleDateFormat( "yyyy-MM-dd ").format(cal.getTime())+"09:00:00"; }else if(type==3){ src/main/java/com/whyc/webSocket/RealTimeSocket.java
@@ -241,7 +241,7 @@ topDto.setCaptestTimelong(deviceState.getDevCaptestTimelong()); topDto.setCaptestCap(deviceState.getDevCaptestCap()); //剩余容量和剩余时间计算 Float restCap = batttestdataInfService.getLastTestDataRestCap(realDto.getBattgroupId()); Float restCap = batttestdataInfService.getLastTestDataRestCap(binf.getMoncapstd(),realDto.getBattgroupId()); topDto.setRestCap(restCap); //实时组端电流,剩余容量,标称容量 if(battRtstate!=null){ src/main/resources/mapper/BattInfMapper.xml
@@ -231,11 +231,14 @@ <if test="stic.product!=null"> and tb_batt_inf.product=#{stic.product} </if> <if test="stic.moncapstd!=null"> and tb_batt_inf.moncapstd=#{stic.moncapstd} </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<=#{stic.inuseEndTimee} and tb_batt_inf.inuse_time<=#{stic.inuseEndTime} </if> <if test="stic.uid>100"> and tb_batt_inf.station_id in(