修改一次值二次值bug
This commit is contained in:
@@ -455,108 +455,154 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
//格式化前端参数
|
//格式化前端参数
|
||||||
formatQueryParamList(commonStatisticalQueryParam);
|
formatQueryParamList(commonStatisticalQueryParam);
|
||||||
if(commonStatisticalQueryParam.getList() != null && !commonStatisticalQueryParam.getList().isEmpty()){
|
if(commonStatisticalQueryParam.getList() != null && !commonStatisticalQueryParam.getList().isEmpty()){
|
||||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||||
if(param.getStatisticalId() == null){
|
if(param.getStatisticalId() == null){
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
||||||
|
for(WlRecord wl : data){
|
||||||
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
|
||||||
|
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||||
|
if(StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||||
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
}
|
}
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
Double ct = Double.valueOf(wlRecord.getCt())/wlRecord.getCt1();
|
||||||
for(WlRecord wl : data){
|
Double pt =Double.valueOf(wlRecord.getPt())/wlRecord.getPt1();
|
||||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
|
|
||||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
|
||||||
if(StrUtil.isBlank(csDataSet.getDataLevel())){
|
|
||||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
|
||||||
}
|
|
||||||
Double ct = Double.valueOf(wlRecord.getCt())/wlRecord.getCt1();
|
|
||||||
Double pt =Double.valueOf(wlRecord.getPt())/wlRecord.getPt1();
|
|
||||||
|
|
||||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
|
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
|
||||||
eleEpdPqds.forEach(epdPqd->{
|
eleEpdPqds.forEach(epdPqd->{
|
||||||
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(temp.getLineId());
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
||||||
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
||||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
return commonQueryParam;
|
return commonQueryParam;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||||
//此处设空时为了有多段时将线条断开前端显示
|
//此处设空时为了有多段时将线条断开前端显示
|
||||||
if(!CollectionUtils.isEmpty(deviceRtData)){
|
if(!CollectionUtils.isEmpty(deviceRtData)){
|
||||||
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
||||||
}
|
}
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
String unit;
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setPosition(position);
|
vo.setPosition(position);
|
||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
vo.setStatMethod(temp.getValueType());
|
vo.setStatMethod(temp.getValueType());
|
||||||
if(temp.getValue()!=null) {
|
if(temp.getValue()!=null) {
|
||||||
double re;
|
double re = 0;
|
||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
unit = epdPqd.getUnit();
|
|
||||||
} else {
|
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
|
||||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
|
||||||
unit = "k" + epdPqd.getUnit();
|
|
||||||
} else {
|
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
|
||||||
unit = epdPqd.getUnit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
|
||||||
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
|
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
|
||||||
} else {
|
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
|
||||||
}
|
|
||||||
unit = epdPqd.getUnit();
|
unit = epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() * pt / 1000;
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() * ct;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() * pt * ct / 1000;
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}else {
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(null);
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
unit = epdPqd.getUnit();
|
case "*PT":
|
||||||
} else {
|
re = temp.getValue() / pt;
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
break;
|
||||||
unit = "k" + epdPqd.getUnit();
|
case "*CT":
|
||||||
} else {
|
re = temp.getValue() / ct;
|
||||||
unit = epdPqd.getUnit();
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() / pt / ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}else {
|
||||||
|
re = temp.getValue();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unit = epdPqd.getUnit();
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
}
|
}
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
vo.setUnit(unit);
|
} else {
|
||||||
vo.setStatisticalIndex(epdPqd.getId());
|
vo.setStatisticalData(null);
|
||||||
vo.setStatisticalName(epdPqd.getName());
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
vo.setAnotherName(epdPqd.getShowName());
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
return vo;
|
unit = epdPqd.getUnit();
|
||||||
}).collect(Collectors.toList());
|
} else {
|
||||||
result.addAll(collect1);
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
});
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
}
|
case "*PT":
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vo.setUnit(unit);
|
||||||
|
vo.setStatisticalIndex(epdPqd.getId());
|
||||||
|
vo.setStatisticalName(epdPqd.getName());
|
||||||
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
result.addAll(collect1);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WlRecord findDevBaseData(WlRecordParam.Record param) {
|
public WlRecord findDevBaseData(WlRecordParam.Record param) {
|
||||||
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user