| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.dto.BattGroupStationInfoWithFileParam; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattGroupDataMapper; |
| | | import com.whyc.pojo.*; |
| | |
| | | @Autowired |
| | | private TestParamService testParamService; |
| | | |
| | | public List<BattgroupData> getListWithTestTime(String fileId) { |
| | | @Autowired |
| | | private StationInfoService stationInfoService; |
| | | |
| | | public BattGroupStationInfoWithFileParam getListWithTestTime(String fileId) { |
| | | BattGroupStationInfoWithFileParam info = new BattGroupStationInfoWithFileParam(); |
| | | //查询站点信息和文件参数信息 |
| | | StationInfo stationInfo = stationInfoService.getByFileId(fileId); |
| | | |
| | | String battGroupId = battGroupInfoService.getByFileId(fileId).getBattgroupId(); |
| | | List<BattgroupData> dataList = mapper.getListWithTestTime(battGroupId); |
| | | //查询系数和阈值是否禁用 |
| | | //BattgroupInfo info = battGroupInfoService.getByBattGroupId(fileId); |
| | | FileParam param = fileParamService.getByFileId(fileId); |
| | | TestParam param2 = testParamService.getFactorsAndThreshold(); |
| | | |
| | | info.setStationInfo(stationInfo); |
| | | info.setFileParam(param); |
| | | if(param2.getEnabled() == 0){ //系数和阈值禁用,不需要判断处理阈值 |
| | | return dataList; |
| | | info.setDataList(dataList); |
| | | return info; |
| | | } |
| | | Float stdVol = param.getBattVol(); |
| | | Float stdRes = param.getBattRes(); |
| | |
| | | Float volHighCoeK2 = param2.getVolHighCoeK2(); |
| | | Float resGoodCoeK3 = param2.getResGoodCoeK3(); |
| | | Float resBadCoeK4 = param2.getResBadCoeK4(); |
| | | Float chainRes = param2.getChainRes(); |
| | | Float chainRes = param.getChainRes(); |
| | | dataList.forEach(data->{ |
| | | //判断处理阈值 |
| | | Float br = data.getBr(); |
| | |
| | | Float cr = data.getCr(); //连接条阻抗 |
| | | |
| | | if(bv < stdVol*volLowCoeK1){ |
| | | data.setLowVolFlag(1); |
| | | data.setLowVolFlag(true); |
| | | }else if(bv > stdVol*volHighCoeK2){ |
| | | data.setHighVolFlag(1); |
| | | data.setHighVolFlag(true); |
| | | } |
| | | |
| | | if(br > stdRes*resGoodCoeK3){ |
| | | if(br > stdRes*resBadCoeK4){ |
| | | data.setHighResFlag2(1); |
| | | data.setHighResFlag2(true); |
| | | }else{ |
| | | data.setHighResFlag1(1); |
| | | data.setHighResFlag1(true); |
| | | } |
| | | } |
| | | |
| | | if(cr > chainRes){ |
| | | data.setHighChainResFlag(1); |
| | | if(cr > chainRes*param2.getChainResCoeK5()){ |
| | | data.setHighChainResFlag(true); |
| | | } |
| | | }); |
| | | return dataList; |
| | | |
| | | info.setDataList(dataList); |
| | | info.setFileParam(param); |
| | | |
| | | return info; |
| | | } |
| | | |
| | | public Map<String, String> getStandardDeviation(List<BattgroupData> monList) { |
| | | Map<String,String> map = new HashMap<>(); |
| | | Stream<BattgroupData> stream = monList.stream(); |
| | | List<Float> bvList = stream.map(BattgroupData::getBv).collect(Collectors.toList()); |
| | | List<Float> brList = stream.map(BattgroupData::getBr).collect(Collectors.toList()); |
| | | List<Float> crList = stream.map(BattgroupData::getCr).collect(Collectors.toList()); |
| | | List<Float> bsList = stream.map(BattgroupData::getBs).collect(Collectors.toList()); |
| | | List<Float> bvList = monList.stream().map(BattgroupData::getBv).collect(Collectors.toList()); |
| | | List<Float> brList = monList.stream().map(BattgroupData::getBr).collect(Collectors.toList()); |
| | | List<Float> crList = monList.stream().map(BattgroupData::getCr).collect(Collectors.toList()); |
| | | List<Float> bsList = monList.stream().map(BattgroupData::getBs).collect(Collectors.toList()); |
| | | float stdDevBv = MathUtil.getStandardDeviation(bvList); |
| | | float stdDevBr = MathUtil.getStandardDeviation(brList); |
| | | float stdDevCr = MathUtil.getStandardDeviation(crList); |
| | |
| | | public Response getComparedList(String baseFileId, String fileId) { |
| | | //String baseBattGroupId = battGroupInfoService.getByFileId(baseFileId).getBattgroupId(); |
| | | //String battGroupId = battGroupInfoService.getByFileId(fileId).getBattgroupId(); |
| | | List<BattgroupData> baseDataList = getListWithTestTime(baseFileId); |
| | | List<BattgroupData> dataList = getListWithTestTime(fileId); |
| | | BattGroupStationInfoWithFileParam baseInfo = getListWithTestTime(baseFileId); |
| | | List<BattgroupData> baseDataList = baseInfo.getDataList(); |
| | | BattGroupStationInfoWithFileParam info = getListWithTestTime(fileId); |
| | | List<BattgroupData> dataList = info.getDataList(); |
| | | |
| | | //内阻变化率,均一性;电压变化率,均一性 |
| | | Map<String,List<String>> map = new HashMap<>(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | List<String> resChangeRate = new LinkedList<>(); |
| | | List<String> volChangeRate = new LinkedList<>(); |
| | | List<String> resBalanceRate = new LinkedList<>(); |
| | |
| | | map.put("volChangeRate",volChangeRate); |
| | | map.put("resBalanceRate",resBalanceRate); |
| | | map.put("volBalanceRate",volBalanceRate); |
| | | map.put("fileParamBase",baseInfo.getFileParam()); |
| | | return new Response().setIII(1,baseDataList,dataList,map,null); |
| | | } |
| | | |