|
|
|
|
@@ -56,84 +56,83 @@ public class QualifiedReportServiceImpl implements QualifiedReportService {
|
|
|
|
|
private final OverLimitClient overLimitClient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<FpyReportDTO> pageTable(QualifiedReportParam qualifiedReportParam) {
|
|
|
|
|
public Page<FpyReportDTO> pageTable(QualifiedReportParam qualifiedReportParam) {
|
|
|
|
|
Page<FpyReportDTO> pageResult = new Page<>(PageFactory.getPageNum(qualifiedReportParam), PageFactory.getPageSize(qualifiedReportParam));
|
|
|
|
|
List<FpyReportDTO> fpyReportDTOList = new ArrayList<>();
|
|
|
|
|
List<String> lineIds = generalDeviceInfoClient.deptGetRunLine(qualifiedReportParam.getDeptId()).getData();
|
|
|
|
|
if(CollUtil.isEmpty(lineIds)){
|
|
|
|
|
return fpyReportDTOList;
|
|
|
|
|
if (CollUtil.isEmpty(lineIds)) {
|
|
|
|
|
return pageResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LineBaseQueryParam lineBaseQueryParam = new LineBaseQueryParam();
|
|
|
|
|
lineBaseQueryParam.setLineIds(lineIds);
|
|
|
|
|
lineBaseQueryParam.setSearchValue(qualifiedReportParam.getSearchValue());
|
|
|
|
|
List<AreaLineInfoVO> areaLineInfoVOList = lineFeignClient.getRichLineInfo(lineBaseQueryParam).getData();
|
|
|
|
|
List<String> lineNewIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getLineId).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<String, AreaLineInfoVO> lineMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId,Function.identity()));
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> limitMap = qualifiedReportMapper.getLimitRateData(new Page<>(PageFactory.getPageNum(qualifiedReportParam),PageFactory.getPageSize(qualifiedReportParam)),lineNewIds, PubUtils.beginTimeToLocalDateTime(qualifiedReportParam.getBeginTime()),PubUtils.endTimeToLocalDateTime(qualifiedReportParam.getEndTime()));
|
|
|
|
|
List<String> realLineIds = limitMap.stream().map(item->item.get("my_index").toString()).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> dayIhMapList = qualifiedReportMapper.getLimitRateDataIHarm(lineIds,qualifiedReportParam.getBeginTime(),qualifiedReportParam.getEndTime());
|
|
|
|
|
Map<String, Map<String, Object>> mapMap = dayIhMapList.stream().collect(Collectors.toMap(it->it.get("MYINDEX").toString(),Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(limitMap)){
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isEmpty(areaLineInfoVOList)){
|
|
|
|
|
return pageResult;
|
|
|
|
|
}
|
|
|
|
|
List<RStatIntegrityD> rStatIntegrityList = lineIntegrityClient.getIntegrityByLineIds(realLineIds,qualifiedReportParam.getBeginTime(),qualifiedReportParam.getEndTime()).getData();
|
|
|
|
|
Map<String, RStatIntegrityD> rStatIntegrityMap = rStatIntegrityList.stream().collect(Collectors.toMap(RStatIntegrityD::getLineIndex, Function.identity()));
|
|
|
|
|
List<String> lineNewIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getLineId).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<String, AreaLineInfoVO> lineMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
Page<Map<String, Object>> page = qualifiedReportMapper.getLimitRateData(new Page<>(PageFactory.getPageNum(qualifiedReportParam), PageFactory.getPageSize(qualifiedReportParam)), lineNewIds, PubUtils.beginTimeToLocalDateTime(qualifiedReportParam.getBeginTime()), PubUtils.endTimeToLocalDateTime(qualifiedReportParam.getEndTime()));
|
|
|
|
|
if (CollUtil.isNotEmpty(page.getRecords())) {
|
|
|
|
|
List<String> realLineIds = page.getRecords().stream().map(item -> item.get("my_index").toString()).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<Overlimit> overLimitList = overLimitClient.getOverLimitByLineIds(realLineIds).getData();
|
|
|
|
|
Map<String, Overlimit> overLimitMap = overLimitList.stream().collect(Collectors.toMap(Overlimit::getId, Function.identity()));
|
|
|
|
|
List<Map<String, Object>> dayIhMapList = qualifiedReportMapper.getLimitRateDataIHarm(lineIds, qualifiedReportParam.getBeginTime(), qualifiedReportParam.getEndTime());
|
|
|
|
|
Map<String, Map<String, Object>> mapMap = dayIhMapList.stream().collect(Collectors.toMap(it -> it.get("MYINDEX").toString(), Function.identity()));
|
|
|
|
|
|
|
|
|
|
for(Map<String, Object> map:limitMap){
|
|
|
|
|
String lineId = map.get("my_index").toString();
|
|
|
|
|
Map<String, Object> mapOverLimit = new HashMap<>();
|
|
|
|
|
try {
|
|
|
|
|
BeanUtils.describe(overLimitMap.get(lineId)).forEach((key, value) -> mapOverLimit.put((String) key, value));
|
|
|
|
|
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
List<RStatIntegrityD> rStatIntegrityList = lineIntegrityClient.getIntegrityByLineIds(realLineIds, qualifiedReportParam.getBeginTime(), qualifiedReportParam.getEndTime()).getData();
|
|
|
|
|
Map<String, RStatIntegrityD> rStatIntegrityMap = rStatIntegrityList.stream().collect(Collectors.toMap(RStatIntegrityD::getLineIndex, Function.identity()));
|
|
|
|
|
|
|
|
|
|
//获取平均值的最大值
|
|
|
|
|
Map<String, Object> iM = mapMap.get(lineId);
|
|
|
|
|
List<Overlimit> overLimitList = overLimitClient.getOverLimitByLineIds(realLineIds).getData();
|
|
|
|
|
Map<String, Overlimit> overLimitMap = overLimitList.stream().collect(Collectors.toMap(Overlimit::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
FpyTagContent fpyTagContent = calAllTag(map, mapOverLimit,iM);
|
|
|
|
|
for (Map<String, Object> map : page.getRecords()) {
|
|
|
|
|
String lineId = map.get("my_index").toString();
|
|
|
|
|
Map<String, Object> mapOverLimit = new HashMap<>();
|
|
|
|
|
try {
|
|
|
|
|
BeanUtils.describe(overLimitMap.get(lineId)).forEach((key, value) -> mapOverLimit.put((String) key, value));
|
|
|
|
|
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
//获取平均值的最大值
|
|
|
|
|
Map<String, Object> iM = mapMap.get(lineId);
|
|
|
|
|
FpyTagContent fpyTagContent = calAllTag(map, mapOverLimit, iM);
|
|
|
|
|
|
|
|
|
|
FpyReportDTO fpyReportData = new FpyReportDTO();
|
|
|
|
|
if (lineMap.containsKey(lineId)) {
|
|
|
|
|
AreaLineInfoVO areaLineInfoVO = lineMap.get(lineId);
|
|
|
|
|
FpyReportDTO fpyReportData = new FpyReportDTO();
|
|
|
|
|
if (lineMap.containsKey(lineId)) {
|
|
|
|
|
AreaLineInfoVO areaLineInfoVO = lineMap.get(lineId);
|
|
|
|
|
BeanUtil.copyProperties(areaLineInfoVO, fpyReportData);
|
|
|
|
|
fpyReportData.setHarmDes(fpyTagContent.getPassFlag());
|
|
|
|
|
fpyReportData.setPowerDes(fpyTagContent.getContent());
|
|
|
|
|
|
|
|
|
|
BeanUtil.copyProperties(areaLineInfoVO, fpyReportData);
|
|
|
|
|
fpyReportData.setHarmDes(fpyTagContent.getPassFlag());
|
|
|
|
|
fpyReportData.setPowerDes(fpyTagContent.getContent());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rStatIntegrityMap.containsKey(lineId)) {
|
|
|
|
|
RStatIntegrityD rStatIntegrityD = rStatIntegrityMap.get(lineId);
|
|
|
|
|
fpyReportData.setIntegrityValue(rStatIntegrityD.getIntegrityData());
|
|
|
|
|
} else {
|
|
|
|
|
fpyReportData.setIntegrityValue(3.14159f);
|
|
|
|
|
}
|
|
|
|
|
fpyReportDTOList.add(fpyReportData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(rStatIntegrityMap.containsKey(lineId)) {
|
|
|
|
|
RStatIntegrityD rStatIntegrityD = rStatIntegrityMap.get(lineId);
|
|
|
|
|
fpyReportData.setIntegrityValue(rStatIntegrityD.getIntegrityData());
|
|
|
|
|
}else {
|
|
|
|
|
fpyReportData.setIntegrityValue(3.14159f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return fpyReportDTOList;
|
|
|
|
|
pageResult.setRecords(fpyReportDTOList);
|
|
|
|
|
pageResult.setTotal(page.getTotal());
|
|
|
|
|
return pageResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 其他指标计算
|
|
|
|
|
*/
|
|
|
|
|
private FpyTagContent calAllTag(Map<String, Object> map, Map<String, Object> mapOverLimit,Map<String, Object> iMap) {
|
|
|
|
|
private FpyTagContent calAllTag(Map<String, Object> map, Map<String, Object> mapOverLimit, Map<String, Object> iMap) {
|
|
|
|
|
StrBuilder content = new StrBuilder();
|
|
|
|
|
BigDecimal alltime = (BigDecimal) map.get("ALLTIME");
|
|
|
|
|
BigDecimal flicketAllTime = (BigDecimal)map.get("FLICKET_ALL_TIME");
|
|
|
|
|
BigDecimal flicketAllTime = (BigDecimal) map.get("FLICKET_ALL_TIME");
|
|
|
|
|
|
|
|
|
|
FpyTagContent fpyTagContent = new FpyTagContent();
|
|
|
|
|
if(alltime.intValue() > 0) {
|
|
|
|
|
if (alltime.intValue() > 0) {
|
|
|
|
|
//频率偏差
|
|
|
|
|
BigDecimal freq = (BigDecimal) map.get("FREQ_DEV_OVERTIME");
|
|
|
|
|
if (freq.intValue() > 0) {
|
|
|
|
|
@@ -159,7 +158,7 @@ public class QualifiedReportServiceImpl implements QualifiedReportService {
|
|
|
|
|
BigDecimal flickOver = (BigDecimal) map.get("FLICKER_OVERTIME");
|
|
|
|
|
if (flickOver.intValue() > 0) {
|
|
|
|
|
BigDecimal flickOverRate = flicketAllTime.subtract(flickOver).divide(flicketAllTime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
|
|
|
content.append("闪变合格率").append(String.valueOf(flickOverRate.floatValue())).append("%;");
|
|
|
|
|
content.append("长时闪变合格率").append(String.valueOf(flickOverRate.floatValue())).append("%;");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//电压畸变
|
|
|
|
|
@@ -187,28 +186,28 @@ public class QualifiedReportServiceImpl implements QualifiedReportService {
|
|
|
|
|
BigDecimal ih = (BigDecimal) map.get(key);
|
|
|
|
|
BigDecimal hegeRate = alltime.subtract(ih).divide(alltime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
|
|
|
if (hegeRate.floatValue() < 95) {
|
|
|
|
|
BigDecimal maxI = (BigDecimal)iMap.get(key);
|
|
|
|
|
BigDecimal maxI = (BigDecimal) iMap.get(key);
|
|
|
|
|
BigDecimal overLimit = new BigDecimal(mapOverLimit.get("iharm" + i).toString());
|
|
|
|
|
content.append(String.valueOf(i)).append("次谐波电流合格率").append(String.valueOf(hegeRate.floatValue())).append("%,限值为").append(String.valueOf(overLimit.floatValue())).append("A," + "最大值为").append(String.valueOf(maxI.setScale(2,RoundingMode.HALF_UP))).append("A;");
|
|
|
|
|
content.append(String.valueOf(i)).append("次谐波电流合格率").append(String.valueOf(hegeRate.floatValue())).append("%,限值为").append(String.valueOf(overLimit.floatValue())).append("A," + "最大值为").append(String.valueOf(maxI.setScale(2, RoundingMode.HALF_UP))).append("A;");
|
|
|
|
|
flagI++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(flagV==0 && flagI==0){
|
|
|
|
|
if (flagV == 0 && flagI == 0) {
|
|
|
|
|
fpyTagContent.setPassFlag(EnumPass.PASS.getDescribe());
|
|
|
|
|
}else if(flagV>0 && flagI==0){
|
|
|
|
|
} else if (flagV > 0 && flagI == 0) {
|
|
|
|
|
fpyTagContent.setPassFlag("谐波电压");
|
|
|
|
|
}else if(flagV==0 && flagI>0){
|
|
|
|
|
} else if (flagV == 0 && flagI > 0) {
|
|
|
|
|
fpyTagContent.setPassFlag("谐波电流");
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
fpyTagContent.setPassFlag("谐波电压;谐波电流");
|
|
|
|
|
}
|
|
|
|
|
if(StrUtil.isBlank(content)){
|
|
|
|
|
if (StrUtil.isBlank(content)) {
|
|
|
|
|
fpyTagContent.setContent("合格;");
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
fpyTagContent.setContent(content.toString());
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
fpyTagContent.setPassFlag("暂无数据");
|
|
|
|
|
fpyTagContent.setContent("暂无数据;");
|
|
|
|
|
}
|
|
|
|
|
|