提交
This commit is contained in:
@@ -14,5 +14,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
public class LinePostionParam {
|
||||
/*拓扑图id*/
|
||||
private String id;
|
||||
private List<AppLineTopologyDiagramPO> pointList;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class LineTopologyDiagramController extends BaseController {
|
||||
@ApiImplicitParam(name = "linePostionParam", value = "监测点拓扑图数据集", required = true)
|
||||
public HttpResult<String> auditList(@RequestBody LinePostionParam linePostionParam){
|
||||
String methodDescribe = getMethodDescribe("auditList");
|
||||
appLineTopologyDiagramService.auditList(linePostionParam.getPointList());
|
||||
appLineTopologyDiagramService.auditList(linePostionParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.LinePostionParam;
|
||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.vo.AppLineTopologyDiagramVO;
|
||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||
@@ -24,5 +25,5 @@ public interface AppLineTopologyDiagramService extends IService<AppLineTopologyD
|
||||
|
||||
List<AppLineTopologyDiagramVO> queryByTopoId(String id);
|
||||
|
||||
void auditList(List<AppLineTopologyDiagramPO> list);
|
||||
void auditList(LinePostionParam linePostionParam);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.mapper.AppLineTopologyDiagramMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryParm;
|
||||
import com.njcn.csdevice.pojo.param.LinePostionParam;
|
||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
@@ -81,11 +82,13 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void auditList(List<AppLineTopologyDiagramPO> list) {
|
||||
list.forEach(temp->{
|
||||
public void auditList(LinePostionParam linePostionParam) {
|
||||
|
||||
|
||||
linePostionParam.getPointList().forEach(temp->{
|
||||
this.lambdaUpdate().eq(AppLineTopologyDiagramPO::getId,temp.getId()).
|
||||
eq(AppLineTopologyDiagramPO::getLineId,temp.getLineId()).set(AppLineTopologyDiagramPO::getLat,temp.getLat()).
|
||||
set(AppLineTopologyDiagramPO::getLng,temp.getLng()).update();
|
||||
set(AppLineTopologyDiagramPO::getLng,temp.getLng()).set(AppLineTopologyDiagramPO::getId,linePostionParam.getId()).update();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -42,7 +43,7 @@ public class MqttMessageHandler {
|
||||
private final ILineTargetService lineTargetService;
|
||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||
private final StableDataService stableDataService;
|
||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@@ -64,12 +65,27 @@ public class MqttMessageHandler {
|
||||
//1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect("7677f94c749dedaff30f911949cbd724").getData();
|
||||
data.forEach(temp->{
|
||||
if(Objects.nonNull(temp.getHarmStart())&&Objects.nonNull(temp.getHarmEnd())){
|
||||
for (int i = temp.getHarmStart(); i < temp.getHarmEnd()+1; i++) {
|
||||
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
commonStatisticalQueryParam.setDevId(devId);
|
||||
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
commonStatisticalQueryParam.setValueType("avg");
|
||||
commonStatisticalQueryParam.setFrequency(i+"");
|
||||
List<ThdDataVO> thdDataVOS = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
tempList.addAll(thdDataVOS);
|
||||
}
|
||||
|
||||
|
||||
}else {
|
||||
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
commonStatisticalQueryParam.setDevId(devId);
|
||||
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
commonStatisticalQueryParam.setValueType("avg");
|
||||
List<ThdDataVO> thdDataVOS = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
tempList.addAll(thdDataVOS);
|
||||
}
|
||||
|
||||
});
|
||||
//过滤M相
|
||||
List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
@@ -82,7 +98,7 @@ public class MqttMessageHandler {
|
||||
});
|
||||
});
|
||||
//过滤谐波电流,谐波电压畸变率求平均值
|
||||
List<ThdDataVO> thdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "ThdPhI(%)")).collect(Collectors.toList());
|
||||
List<ThdDataVO> thdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdU(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect = thdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
@@ -96,7 +112,7 @@ public class MqttMessageHandler {
|
||||
}
|
||||
});
|
||||
|
||||
List<ThdDataVO> thdV = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "ThdPhV(%)")).collect(Collectors.toList());
|
||||
List<ThdDataVO> thdV = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdI(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect1 = thdV.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect1.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
@@ -109,6 +125,32 @@ public class MqttMessageHandler {
|
||||
|
||||
}
|
||||
});
|
||||
List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect3.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
thdDataVO.setPhase("avg");
|
||||
result.add(thdDataVO);
|
||||
|
||||
}
|
||||
});
|
||||
List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect4.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
thdDataVO.setPhase("avg");
|
||||
result.add(thdDataVO);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
List<ThdDataVO> notM = tempList.stream().filter(temp -> !Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -49,6 +50,7 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
private final CommonService commonService;
|
||||
private final DecimalFormat df = new DecimalFormat("#0.0000");
|
||||
|
||||
@Override
|
||||
public List<ThdDataVO> queryThdData(String devId, String statisticalName) {
|
||||
@@ -174,21 +176,29 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
|
||||
EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||
Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
|
||||
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
||||
|
||||
String frequency ="";
|
||||
if(Objects.isNull(commonStatisticalQueryParam.getFrequency())){
|
||||
frequency ="";
|
||||
}else {
|
||||
frequency = "_"+commonStatisticalQueryParam.getFrequency();
|
||||
}
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(collect, data.getClassId(), data.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType());
|
||||
List<CsLinePO> finalCsLinePOList = csLinePOList;
|
||||
String finalFrequency = frequency;
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
vo.setPhase(temp.getPhaseType());
|
||||
/*AB相映射A,BA相映射B,CA-》C*/
|
||||
|
||||
vo.setPhase(phaseReflection(temp.getPhaseType()));
|
||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(BigDecimal.valueOf(temp.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setStatisticalIndex(data.getId());
|
||||
vo.setStatisticalName(data.getName()+"("+data.getUnit()+")");
|
||||
vo.setStatisticalName(data.getName()+ finalFrequency +"("+data.getUnit()+")");
|
||||
vo.setAnotherName(data.getShowName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
@@ -219,7 +229,7 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(BigDecimal.valueOf(temp.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setStatisticalIndex(data.getId());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
@@ -256,7 +266,7 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(BigDecimal.valueOf(temp.getValue()).setScale(4, RoundingMode.UP).doubleValue());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setStatisticalIndex(data.getId());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
@@ -264,4 +274,17 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
return collect1;
|
||||
}
|
||||
|
||||
private String phaseReflection(String phase){
|
||||
switch (phase) {
|
||||
case "AB":
|
||||
return "A";
|
||||
case "BC":
|
||||
return "B";
|
||||
case "CA":
|
||||
return "C";
|
||||
default:
|
||||
return phase;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user