| | |
| | | import com.whyc.dto.TestDaoFactory; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.BatttestdataInf; |
| | | import com.whyc.pojo.PageParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class BattTestDataInf2Service { |
| | |
| | | @Autowired |
| | | private BattResDataService resDataService; |
| | | |
| | | @Autowired |
| | | private PageParamService pageParamService; |
| | | |
| | | @Autowired |
| | | private SubTablePageInfoService subService; |
| | | |
| | | /*新版接口不包含内阻数据 |
| | | * */ |
| | | public PageInfo<BatttestdataInf> calcTestData(BattTestDataDTO paramDto, Integer pageNum, Integer pageSize) { |
| | | //获取充放电时间过滤参数 |
| | | List<PageParam> pageParamList = pageParamService.getList2ByCategoryId(14); |
| | | int jcDischargeFilterTime = pageParamList.get(2).getStatus() * 60; |
| | | int jcChargeFilterTime = pageParamList.get(3).getStatus() * 60; |
| | | paramDto.setJcDischargeFilterTime(jcDischargeFilterTime); |
| | | paramDto.setJcChargeFilterTime(jcChargeFilterTime); |
| | | |
| | | List<BatttestdataInf> calcDataList = new LinkedList<>(); |
| | | //查询电池组 电池信息或者电导信息 |
| | | PageHelper.startPage(pageNum,pageSize,true); |
| | | List<BatttestdataInf> battTestInfList = mapper.getTestInfList(paramDto); |
| | | PageHelper.startPage(pageNum, pageSize, true); |
| | | List<BatttestdataInf> battTestInfList = mapper.getTestInfList(paramDto); |
| | | PageInfo<BatttestdataInf> pageInfo = new PageInfo(battTestInfList); |
| | | |
| | | //查询电池测试过程具体电池组的落后单体相关信息 |
| | | //获取容量告警和容量更换告警参数 |
| | | List<Float> paramList = alarmParamMapper.getParamInfoList(AlarmDaoFactory.Alarm_CapAlarm,AlarmDaoFactory.Alarm_CapChange); |
| | | List<Float> paramList = alarmParamMapper.getParamInfoList(AlarmDaoFactory.Alarm_CapAlarm, AlarmDaoFactory.Alarm_CapChange); |
| | | Float alarmLowCoe4CapAlarm = paramList.get(0); |
| | | Float alarmLowCoe4CapChange = paramList.get(1); |
| | | //电池test测试 |
| | | if(paramDto.getTestType().intValue() != BattTestEnum.TEST_TYPE_RES_SER.getValue()){ |
| | | battTestInfList.forEach(battTestDataInf ->{ |
| | | battTestInfList.forEach(battTestDataInf -> { |
| | | battTestDataInf.setAlarmLowCoe4CapAlarm(alarmLowCoe4CapAlarm); |
| | | battTestDataInf.setAlarmLowCoe4CapChange(alarmLowCoe4CapChange); |
| | | //获取测试仪表类型 |
| | | battTestDataInf.setTeststarttypeHex(TestDaoFactory.getTest_starttypeHex(battTestDataInf.getTestStarttype(), battTestDataInf.getTestType(), battTestDataInf.getTestDatatype())); |
| | | |
| | | //通过stop表获取落后单体信息 |
| | | String exist = commonMapper.existTable("db_batt_testdata", "tb_batttestdatastop_" + battTestDataInf.getBattGroupId()); |
| | | if (exist != null) { |
| | | //计算落后信息 |
| | | battTestDataInf = testStopService.calcBehindInfo(battTestDataInf); |
| | | } |
| | | battTestDataInf.setMinMonvol(BigDecimal.valueOf(battTestDataInf.getMinMonvol()).setScale(3, BigDecimal.ROUND_HALF_UP).floatValue()); |
| | | |
| | | calcDataList.add(battTestDataInf); |
| | | }); |
| | | pageInfo.setList(calcDataList); |
| | | return pageInfo; |
| | | } |
| | | |
| | | /*旧版接口包含内阻数据 |
| | | * */ |
| | | public PageInfo<BatttestdataInf> calcTestData1(BattTestDataDTO paramDto, Integer pageNum, Integer pageSize) { |
| | | List<BatttestdataInf> calcDataList = new LinkedList<>(); |
| | | //查询电池组 电池信息或者电导信息 |
| | | PageHelper.startPage(pageNum, pageSize, true); |
| | | List<BatttestdataInf> battTestInfList = mapper.getTestInfList1(paramDto); |
| | | PageInfo<BatttestdataInf> pageInfo = new PageInfo(battTestInfList); |
| | | |
| | | //查询电池测试过程具体电池组的落后单体相关信息 |
| | | //获取容量告警和容量更换告警参数 |
| | | List<Float> paramList = alarmParamMapper.getParamInfoList(AlarmDaoFactory.Alarm_CapAlarm, AlarmDaoFactory.Alarm_CapChange); |
| | | Float alarmLowCoe4CapAlarm = paramList.get(0); |
| | | Float alarmLowCoe4CapChange = paramList.get(1); |
| | | //电池test测试 |
| | | if (paramDto.getTestType().intValue() != BattTestEnum.TEST_TYPE_RES_SER.getValue()) { |
| | | battTestInfList.forEach(battTestDataInf -> { |
| | | battTestDataInf.setAlarmLowCoe4CapAlarm(alarmLowCoe4CapAlarm); |
| | | battTestDataInf.setAlarmLowCoe4CapChange(alarmLowCoe4CapChange); |
| | | //获取测试仪表类型 |
| | | battTestDataInf.setTeststarttypeHex(TestDaoFactory.getTest_starttypeHex(battTestDataInf.getTestStarttype(),battTestDataInf.getTestType())); |
| | | battTestDataInf.setTeststarttypeHex(TestDaoFactory.getTest_starttypeHex1(battTestDataInf.getTestStarttype(), battTestDataInf.getTestType())); |
| | | |
| | | //通过stop表获取落后单体信息 |
| | | String exist = commonMapper.existTable("db_batt_testdata","tb_batttestdatastop_"+battTestDataInf.getBattGroupId()); |
| | | if(exist!=null){ |
| | | String exist = commonMapper.existTable("db_batt_testdata", "tb_batttestdatastop_" + battTestDataInf.getBattGroupId()); |
| | | if (exist != null) { |
| | | //计算落后信息 |
| | | battTestDataInf = testStopService.calcBehindInfo(battTestDataInf); |
| | | } |
| | | battTestDataInf.setMinMonvol(BigDecimal.valueOf(battTestDataInf.getMinMonvol()).setScale(3,BigDecimal.ROUND_HALF_UP).floatValue()); |
| | | battTestDataInf.setMinMonvol(BigDecimal.valueOf(battTestDataInf.getMinMonvol()).setScale(3, BigDecimal.ROUND_HALF_UP).floatValue()); |
| | | |
| | | calcDataList.add(battTestDataInf); |
| | | }); |
| | |
| | | public boolean delete(Integer num, Integer battGroupId, Integer testRecordCount, Integer testType) { |
| | | |
| | | //充电,放电,在线监测 |
| | | if(testType == BattTestEnum.TEST_TYPE_CHARGE.getValue() || |
| | | /*if(testType == BattTestEnum.TEST_TYPE_CHARGE.getValue() || |
| | | testType == BattTestEnum.TEST_TYPE_DISCHARGE.getValue()|| |
| | | testType == BattTestEnum.TEST_TYPE_MONITOR.getValue() |
| | | )*/ |
| | | if(testType.equals(BattTestEnum.TEST_TYPE_CHARGE.getValue()) || |
| | | testType.equals(BattTestEnum.TEST_TYPE_DISCHARGE.getValue())|| |
| | | testType.equals(BattTestEnum.TEST_TYPE_MONITOR.getValue()) |
| | | ){ |
| | | //删除 测试表inf里的信息 |
| | | testDataInfMapper.deleteById(num); |
| | |
| | | //删除 测试表inf里的信息 |
| | | resDataInfMapper.deleteById(num); |
| | | //删除 测试表_battGroupId里面对应的单体信息 |
| | | resDataMapper.deleteByTestRecordCount(battGroupId,testRecordCount); |
| | | //resDataMapper.deleteByTestRecordCount(battGroupId,testRecordCount); |
| | | subService.deleteByTestRecordCount(battGroupId,testRecordCount); |
| | | } |
| | | return true; |
| | | } |