1.完善稳态指标符合性占比树形结构
2.完成终端评价和异常终端详情联调
This commit is contained in:
@@ -64,6 +64,10 @@ public class SteadyExceedRateVO implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty("数据时间")
|
||||
private String time;
|
||||
|
||||
@ApiModelProperty("监测对象id")
|
||||
private String objId;
|
||||
|
||||
/**
|
||||
* 子集
|
||||
*/
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
C.Name voltageLevel,
|
||||
D.IP networkParam,
|
||||
C1.Name factoryName,
|
||||
A.Name lineName
|
||||
A.Name lineName,
|
||||
detail.obj_id
|
||||
FROM
|
||||
pq_line A,
|
||||
pq_line_detail detail,
|
||||
pq_voltage B,
|
||||
sys_dict_data C,
|
||||
pq_device D,
|
||||
@@ -26,6 +28,7 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
AND A.Pid = B.Id
|
||||
AND A.Id = detail.Id
|
||||
AND B.Scale = C.Id
|
||||
AND A.Pid = A1.Id
|
||||
AND A1.Pid = D.Id
|
||||
|
||||
@@ -77,7 +77,7 @@ public class HarmonicServiceImpl implements IHarmonicService {
|
||||
return list;
|
||||
}
|
||||
Map<String, UserLedgerVO> userLedgerVOMap;
|
||||
if (Objects.isNull(harmonicPublicParam.getPowerFlag()) || !PowerFlagEnum.GRID_SIDE.getCode().equals(harmonicPublicParam.getPowerFlag())) {
|
||||
if (harmonicPublicParam.isUserLedger()) {
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
} else {
|
||||
|
||||
@@ -10,6 +10,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.utils.PublicDateUtil;
|
||||
@@ -24,6 +25,9 @@ import com.njcn.harmonic.service.IRStatLimitRateDService;
|
||||
import com.njcn.harmonic.service.SteadyExceedRateService;
|
||||
import com.njcn.harmonic.utils.PubUtils;
|
||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -31,11 +35,11 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -48,17 +52,23 @@ import java.util.stream.Collectors;
|
||||
public class SteadyExceedRateServiceImpl implements SteadyExceedRateService {
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final SteadyExceedRateMapper steadyExceedRateMapper;
|
||||
|
||||
private final IRStatLimitRateDService rateDService;
|
||||
private final RStatLimitRateDMapper rateDMapper;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public List<SteadyExceedRateVO> getSteadyExceedRateData(DeviceInfoParam.BusinessParam steadyExceedParam) {
|
||||
List<SteadyExceedRateVO> steadyExceedRateVOS = new ArrayList<>();
|
||||
//按照条件获取实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyExceedParam).getData();
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = new HashMap<>();
|
||||
if(steadyExceedParam.isUserLedger()){
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
}
|
||||
|
||||
for (GeneralDeviceDTO generalDeviceDTO: deviceDataList){
|
||||
List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||
if (CollectionUtils.isEmpty(lineIndexes)) {
|
||||
@@ -68,7 +78,7 @@ public class SteadyExceedRateServiceImpl implements SteadyExceedRateService {
|
||||
steadyExceedRateVO.setId(generalDeviceDTO.getIndex());
|
||||
steadyExceedRateVO.setName(generalDeviceDTO.getName());
|
||||
//组装子集数据树
|
||||
List<SteadyExceedRateVO> treeList = getTreeData(lineIndexes, steadyExceedParam);
|
||||
List<SteadyExceedRateVO> treeList = getTreeData(lineIndexes, steadyExceedParam,userLedgerVOMap,steadyExceedParam.getPowerFlag());
|
||||
//父级数据
|
||||
steadyExceedRateVO.setSteadyExceedRate(PubUtils.dataLimits(NumberUtil.round(treeList.stream().mapToDouble(SteadyExceedRateVO::getSteadyExceedRate).average().orElse(0), 2).doubleValue()));
|
||||
|
||||
@@ -249,17 +259,9 @@ public class SteadyExceedRateServiceImpl implements SteadyExceedRateService {
|
||||
/**
|
||||
* 获取父级每层数据
|
||||
*/
|
||||
private List<SteadyExceedRateVO> getTreeData(List<String> lineIndexes, DeviceInfoParam.BusinessParam steadyExceedParam) {
|
||||
private List<SteadyExceedRateVO> getTreeData(List<String> lineIndexes, DeviceInfoParam.BusinessParam steadyExceedParam,Map<String,UserLedgerVO> userLedgerVOMap,Integer powerFlag) {
|
||||
//监测点集合
|
||||
List<SteadyExceedRateVO> monitorList = steadyExceedRateMapper.getSteadyExceedRateData(lineIndexes);
|
||||
//母线集合
|
||||
List<SteadyExceedRateVO> busBarList = steadyExceedRateMapper.getLineInfoByList(monitorList.stream().map(SteadyExceedRateVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//终端集合
|
||||
List<SteadyExceedRateVO> deviceList = steadyExceedRateMapper.getLineInfoByList(busBarList.stream().map(SteadyExceedRateVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//变电站集合
|
||||
List<SteadyExceedRateVO> substationList = steadyExceedRateMapper.getLineInfoByList(deviceList.stream().map(SteadyExceedRateVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//供电公司集合
|
||||
List<SteadyExceedRateVO> powerCompanyList = steadyExceedRateMapper.getLineInfoByList(substationList.stream().map(SteadyExceedRateVO::getPid).distinct().collect(Collectors.toList()));
|
||||
|
||||
List<LimitRatePO> qualifiesRate = getQualifiesRate(lineIndexes, steadyExceedParam.getSearchBeginTime(), steadyExceedParam.getSearchEndTime());
|
||||
//根据监测点分组
|
||||
@@ -272,12 +274,49 @@ public class SteadyExceedRateServiceImpl implements SteadyExceedRateService {
|
||||
steadyExceedRateVO.setSteadyExceedRate(3.14159);
|
||||
}
|
||||
});
|
||||
setChildesList(substationList,monitorList);
|
||||
|
||||
|
||||
List<SteadyExceedRateVO> userLedgerList = new ArrayList<>();
|
||||
List<SteadyExceedRateVO> powerLedgerList = new ArrayList<>();
|
||||
if(Objects.equals(PowerFlagEnum.NO_GRID_SIDE.getCode(),powerFlag)){
|
||||
userLedgerList = monitorList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}else if(Objects.equals(PowerFlagEnum.GRID_SIDE.getCode(),powerFlag)){
|
||||
powerLedgerList = monitorList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}else {
|
||||
userLedgerList = monitorList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
powerLedgerList = monitorList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<SteadyExceedRateVO> userTemList = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(userLedgerList)){
|
||||
Map<String,List<SteadyExceedRateVO>> objMap = userLedgerList.stream().collect(Collectors.groupingBy(SteadyExceedRateVO::getObjId));
|
||||
objMap.forEach((obj,list) -> {
|
||||
SteadyExceedRateVO thDistortionVO = new SteadyExceedRateVO();
|
||||
if (userLedgerVOMap.containsKey(obj)) {
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.get(obj);
|
||||
thDistortionVO.setId(userLedgerVO.getId());
|
||||
thDistortionVO.setName(userLedgerVO.getProjectName());
|
||||
thDistortionVO.setPid(userLedgerVO.getStationId());
|
||||
thDistortionVO.setSteadyExceedRate(list.stream().filter(it->it.getSteadyExceedRate()!=3.14159).mapToDouble(SteadyExceedRateVO::getSteadyExceedRate).average().orElse(3.14159));
|
||||
thDistortionVO.setChildren(list);
|
||||
userTemList.add(thDistortionVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//变电站集合
|
||||
List<SteadyExceedRateVO> substationList = steadyExceedRateMapper.getLineInfoByList(monitorList.stream().map(it->it.getPidS().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()])
|
||||
.distinct().collect(Collectors.toList()));
|
||||
//供电公司集合
|
||||
List<SteadyExceedRateVO> powerCompanyList = steadyExceedRateMapper.getLineInfoByList(monitorList.stream().map(it->it.getPidS().split(StrUtil.COMMA)[LineBaseEnum.GD_LEVEL.getCode()])
|
||||
.distinct().collect(Collectors.toList()));
|
||||
|
||||
setChildesList(substationList,powerLedgerList,userTemList);
|
||||
setFatherDistortion(substationList);
|
||||
setSubstationData(substationList);
|
||||
powerCompanyList.stream().peek(item -> item.setChildren(getChildCategoryList(item, substationList))).collect(Collectors.toList());
|
||||
setFatherDistortion(powerCompanyList);
|
||||
|
||||
return powerCompanyList;
|
||||
}
|
||||
|
||||
@@ -312,17 +351,33 @@ public class SteadyExceedRateServiceImpl implements SteadyExceedRateService {
|
||||
private List<SteadyExceedRateVO> getChildCategoryList(SteadyExceedRateVO item, List<SteadyExceedRateVO> child) {
|
||||
return child.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||
}
|
||||
private void setChildesList(List<SteadyExceedRateVO> item, List<SteadyExceedRateVO> childes) {
|
||||
/**
|
||||
* @Description:
|
||||
* @param item
|
||||
* @param childes 用户
|
||||
* @param userList 变电站
|
||||
* @Author: wr
|
||||
* @Date: 2025/5/13 9:27
|
||||
*/
|
||||
private void setChildesList(List<SteadyExceedRateVO> item, List<SteadyExceedRateVO> childes,List<SteadyExceedRateVO> userList) {
|
||||
//groupLine变电站索引和监测点集合
|
||||
Map<String, List<SteadyExceedRateVO>> groupLine;
|
||||
groupLine = childes.stream().collect(Collectors.groupingBy(steadyExceedRateVO -> {
|
||||
String[] pid = steadyExceedRateVO.getPidS().split(",");
|
||||
groupLine = childes.stream().collect(Collectors.groupingBy(thDistortionVO -> {
|
||||
String[] pid = thDistortionVO.getPidS().split(StrUtil.COMMA);
|
||||
return pid[LineBaseEnum.SUB_LEVEL.getCode()];
|
||||
}));
|
||||
item.stream().peek(steadyExceedRateVO -> {
|
||||
if (!CollectionUtils.isEmpty(groupLine.get(steadyExceedRateVO.getId()))) {
|
||||
steadyExceedRateVO.setChildren(groupLine.get(steadyExceedRateVO.getId()));
|
||||
|
||||
Map<String,List<SteadyExceedRateVO>> userMap = userList.stream().collect(Collectors.groupingBy(SteadyExceedRateVO::getPid));
|
||||
item.forEach(thDistortionVO -> {
|
||||
List<SteadyExceedRateVO> temList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(groupLine.get(thDistortionVO.getId()))) {
|
||||
temList.addAll(groupLine.get(thDistortionVO.getId()));
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
if(userMap.containsKey(thDistortionVO.getId())){
|
||||
temList.addAll(userMap.get(thDistortionVO.getId()));
|
||||
}
|
||||
thDistortionVO.setChildren(temList);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,8 +51,11 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
List<SteadyQualifyVO> steadyQualifyList = new ArrayList<>();
|
||||
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
List<UserLedgerVO> userLedgerList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
Map<String, UserLedgerVO> userMap = userLedgerList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
Map<String, UserLedgerVO> userMap = new HashMap<>();
|
||||
if (steadyParam.isUserLedger()) {
|
||||
List<UserLedgerVO> userLedgerList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
userMap.putAll(userLedgerList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity())));
|
||||
}
|
||||
|
||||
//按照条件获取实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyParam).getData();
|
||||
@@ -312,72 +315,72 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
steadyQualifyVO.setNegativeCurrent(calculate(steadyQualifyDTO.getAllTime(), steadyQualifyDTO.getINegOvertime()));
|
||||
//谐波电压
|
||||
steadyQualifyVO.setHarmonicVoltage(calculateV(steadyQualifyDTO.getAllTime(), (steadyQualifyDTO.getUaberranceOvertime() +
|
||||
steadyQualifyDTO.getUharm2Overtime() +
|
||||
steadyQualifyDTO.getUharm3Overtime() +
|
||||
steadyQualifyDTO.getUharm4Overtime() +
|
||||
steadyQualifyDTO.getUharm5Overtime() +
|
||||
steadyQualifyDTO.getUharm6Overtime() +
|
||||
steadyQualifyDTO.getUharm7Overtime() +
|
||||
steadyQualifyDTO.getUharm8Overtime() +
|
||||
steadyQualifyDTO.getUharm9Overtime() +
|
||||
steadyQualifyDTO.getUharm10Overtime() +
|
||||
steadyQualifyDTO.getUharm11Overtime() +
|
||||
steadyQualifyDTO.getUharm12Overtime() +
|
||||
steadyQualifyDTO.getUharm13Overtime() +
|
||||
steadyQualifyDTO.getUharm14Overtime() +
|
||||
steadyQualifyDTO.getUharm15Overtime() +
|
||||
steadyQualifyDTO.getUharm16Overtime() +
|
||||
steadyQualifyDTO.getUharm17Overtime() +
|
||||
steadyQualifyDTO.getUharm18Overtime() +
|
||||
steadyQualifyDTO.getUharm19Overtime() +
|
||||
steadyQualifyDTO.getUharm20Overtime() +
|
||||
steadyQualifyDTO.getUharm21Overtime() +
|
||||
steadyQualifyDTO.getUharm22Overtime() +
|
||||
steadyQualifyDTO.getUharm23Overtime() +
|
||||
steadyQualifyDTO.getUharm24Overtime() +
|
||||
steadyQualifyDTO.getUharm25Overtime())));
|
||||
steadyQualifyDTO.getUharm2Overtime() +
|
||||
steadyQualifyDTO.getUharm3Overtime() +
|
||||
steadyQualifyDTO.getUharm4Overtime() +
|
||||
steadyQualifyDTO.getUharm5Overtime() +
|
||||
steadyQualifyDTO.getUharm6Overtime() +
|
||||
steadyQualifyDTO.getUharm7Overtime() +
|
||||
steadyQualifyDTO.getUharm8Overtime() +
|
||||
steadyQualifyDTO.getUharm9Overtime() +
|
||||
steadyQualifyDTO.getUharm10Overtime() +
|
||||
steadyQualifyDTO.getUharm11Overtime() +
|
||||
steadyQualifyDTO.getUharm12Overtime() +
|
||||
steadyQualifyDTO.getUharm13Overtime() +
|
||||
steadyQualifyDTO.getUharm14Overtime() +
|
||||
steadyQualifyDTO.getUharm15Overtime() +
|
||||
steadyQualifyDTO.getUharm16Overtime() +
|
||||
steadyQualifyDTO.getUharm17Overtime() +
|
||||
steadyQualifyDTO.getUharm18Overtime() +
|
||||
steadyQualifyDTO.getUharm19Overtime() +
|
||||
steadyQualifyDTO.getUharm20Overtime() +
|
||||
steadyQualifyDTO.getUharm21Overtime() +
|
||||
steadyQualifyDTO.getUharm22Overtime() +
|
||||
steadyQualifyDTO.getUharm23Overtime() +
|
||||
steadyQualifyDTO.getUharm24Overtime() +
|
||||
steadyQualifyDTO.getUharm25Overtime())));
|
||||
//谐波电流
|
||||
steadyQualifyVO.setHarmonicCurrent(calculateI(steadyQualifyDTO.getAllTime(), (steadyQualifyDTO.getIharm2Overtime() +
|
||||
steadyQualifyDTO.getIharm3Overtime() +
|
||||
steadyQualifyDTO.getIharm4Overtime() +
|
||||
steadyQualifyDTO.getIharm5Overtime() +
|
||||
steadyQualifyDTO.getIharm6Overtime() +
|
||||
steadyQualifyDTO.getIharm7Overtime() +
|
||||
steadyQualifyDTO.getIharm8Overtime() +
|
||||
steadyQualifyDTO.getIharm9Overtime() +
|
||||
steadyQualifyDTO.getIharm10Overtime() +
|
||||
steadyQualifyDTO.getIharm11Overtime() +
|
||||
steadyQualifyDTO.getIharm12Overtime() +
|
||||
steadyQualifyDTO.getIharm13Overtime() +
|
||||
steadyQualifyDTO.getIharm14Overtime() +
|
||||
steadyQualifyDTO.getIharm15Overtime() +
|
||||
steadyQualifyDTO.getIharm16Overtime() +
|
||||
steadyQualifyDTO.getIharm17Overtime() +
|
||||
steadyQualifyDTO.getIharm18Overtime() +
|
||||
steadyQualifyDTO.getIharm19Overtime() +
|
||||
steadyQualifyDTO.getIharm20Overtime() +
|
||||
steadyQualifyDTO.getIharm21Overtime() +
|
||||
steadyQualifyDTO.getIharm22Overtime() +
|
||||
steadyQualifyDTO.getIharm23Overtime() +
|
||||
steadyQualifyDTO.getIharm24Overtime() +
|
||||
steadyQualifyDTO.getIharm25Overtime())));
|
||||
steadyQualifyDTO.getIharm3Overtime() +
|
||||
steadyQualifyDTO.getIharm4Overtime() +
|
||||
steadyQualifyDTO.getIharm5Overtime() +
|
||||
steadyQualifyDTO.getIharm6Overtime() +
|
||||
steadyQualifyDTO.getIharm7Overtime() +
|
||||
steadyQualifyDTO.getIharm8Overtime() +
|
||||
steadyQualifyDTO.getIharm9Overtime() +
|
||||
steadyQualifyDTO.getIharm10Overtime() +
|
||||
steadyQualifyDTO.getIharm11Overtime() +
|
||||
steadyQualifyDTO.getIharm12Overtime() +
|
||||
steadyQualifyDTO.getIharm13Overtime() +
|
||||
steadyQualifyDTO.getIharm14Overtime() +
|
||||
steadyQualifyDTO.getIharm15Overtime() +
|
||||
steadyQualifyDTO.getIharm16Overtime() +
|
||||
steadyQualifyDTO.getIharm17Overtime() +
|
||||
steadyQualifyDTO.getIharm18Overtime() +
|
||||
steadyQualifyDTO.getIharm19Overtime() +
|
||||
steadyQualifyDTO.getIharm20Overtime() +
|
||||
steadyQualifyDTO.getIharm21Overtime() +
|
||||
steadyQualifyDTO.getIharm22Overtime() +
|
||||
steadyQualifyDTO.getIharm23Overtime() +
|
||||
steadyQualifyDTO.getIharm24Overtime() +
|
||||
steadyQualifyDTO.getIharm25Overtime())));
|
||||
//间谐波电压含有率
|
||||
steadyQualifyVO.setInterHarmonic(calculateIN(steadyQualifyDTO.getAllTime(), (steadyQualifyDTO.getInuharm1Overtime() +
|
||||
steadyQualifyDTO.getInuharm2Overtime() +
|
||||
steadyQualifyDTO.getInuharm3Overtime() +
|
||||
steadyQualifyDTO.getInuharm4Overtime() +
|
||||
steadyQualifyDTO.getInuharm5Overtime() +
|
||||
steadyQualifyDTO.getInuharm6Overtime() +
|
||||
steadyQualifyDTO.getInuharm7Overtime() +
|
||||
steadyQualifyDTO.getInuharm8Overtime() +
|
||||
steadyQualifyDTO.getInuharm9Overtime() +
|
||||
steadyQualifyDTO.getInuharm10Overtime() +
|
||||
steadyQualifyDTO.getInuharm11Overtime() +
|
||||
steadyQualifyDTO.getInuharm12Overtime() +
|
||||
steadyQualifyDTO.getInuharm13Overtime() +
|
||||
steadyQualifyDTO.getInuharm14Overtime() +
|
||||
steadyQualifyDTO.getInuharm15Overtime() +
|
||||
steadyQualifyDTO.getInuharm16Overtime())));
|
||||
steadyQualifyDTO.getInuharm2Overtime() +
|
||||
steadyQualifyDTO.getInuharm3Overtime() +
|
||||
steadyQualifyDTO.getInuharm4Overtime() +
|
||||
steadyQualifyDTO.getInuharm5Overtime() +
|
||||
steadyQualifyDTO.getInuharm6Overtime() +
|
||||
steadyQualifyDTO.getInuharm7Overtime() +
|
||||
steadyQualifyDTO.getInuharm8Overtime() +
|
||||
steadyQualifyDTO.getInuharm9Overtime() +
|
||||
steadyQualifyDTO.getInuharm10Overtime() +
|
||||
steadyQualifyDTO.getInuharm11Overtime() +
|
||||
steadyQualifyDTO.getInuharm12Overtime() +
|
||||
steadyQualifyDTO.getInuharm13Overtime() +
|
||||
steadyQualifyDTO.getInuharm14Overtime() +
|
||||
steadyQualifyDTO.getInuharm15Overtime() +
|
||||
steadyQualifyDTO.getInuharm16Overtime())));
|
||||
list.add(steadyQualifyVO);
|
||||
}
|
||||
}
|
||||
@@ -426,7 +429,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
* @param endTime
|
||||
*/
|
||||
private List<RStatLimitRateDPO> getQualifiesRate(List<String> lineIndexes, String startTime, String endTime) {
|
||||
return rateDService.list(new LambdaQueryWrapper<RStatLimitRateDPO>()
|
||||
return rateDService.list(new LambdaQueryWrapper<RStatLimitRateDPO>()
|
||||
.in(RStatLimitRateDPO::getLineId, lineIndexes)
|
||||
.eq(RStatLimitRateDPO::getPhasicType, "T")
|
||||
.ge(StrUtil.isNotBlank(startTime), RStatLimitRateDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(startTime)))
|
||||
@@ -440,7 +443,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
|
||||
return 3.14159;
|
||||
} else {
|
||||
if (allTime >= overTime) {
|
||||
return NumberUtil.round((allTime - overTime)*1.0 / allTime * 100.0, 2).doubleValue();
|
||||
return NumberUtil.round((allTime - overTime) * 1.0 / allTime * 100.0, 2).doubleValue();
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@@ -14,19 +14,14 @@ import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalOnlineRateDataVO;
|
||||
import com.njcn.harmonic.mapper.RMpVThdMapper;
|
||||
import com.njcn.harmonic.mapper.THDistortionMapper;
|
||||
import com.njcn.harmonic.pojo.dto.PublicDTO;
|
||||
import com.njcn.harmonic.pojo.po.RMpVThd;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.harmonic.pojo.vo.RMpVThdVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionVO;
|
||||
import com.njcn.harmonic.service.IRStatDataVDService;
|
||||
import com.njcn.harmonic.service.THDistortionService;
|
||||
import com.njcn.harmonic.utils.PubUtils;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
@@ -52,27 +47,22 @@ import java.util.stream.Collectors;
|
||||
public class THDistortionServiceImpl implements THDistortionService {
|
||||
|
||||
private final GeneralInfo generalInfo;
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final THDistortionMapper thDistortionMapper;
|
||||
|
||||
private final RMpVThdMapper rMpVThdMapper;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
@Override
|
||||
public List<THDistortionVO> getTHDistortionData(DeviceInfoParam.BusinessParam thDistortionParam,Integer nodeType) {
|
||||
public List<THDistortionVO> getTHDistortionData(DeviceInfoParam.BusinessParam thDistortionParam, Integer nodeType) {
|
||||
List<THDistortionVO> thDistortionVOS = new ArrayList<>();
|
||||
|
||||
//按照条件获取实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> deviceList = generalDeviceInfoClient.getPracticalRunDeviceInfo(new DeviceInfoParam(thDistortionParam.getStatisticalType(), thDistortionParam.getDeptIndex(), generalInfo.getMicroServiceName(), thDistortionParam.getScale(), thDistortionParam.getManufacturer(), thDistortionParam.getLoadType())).getData();
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = new HashMap<>();
|
||||
if(Objects.isNull(thDistortionParam.getPowerFlag()) || Objects.equals(PowerFlagEnum.NO_GRID_SIDE.getCode(),thDistortionParam.getPowerFlag())){
|
||||
if (thDistortionParam.isUserLedger()) {
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
userLedgerVOMap.putAll(userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity())));
|
||||
}
|
||||
|
||||
|
||||
@@ -90,18 +80,17 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
List<PublicDTO> condition = getCondition(lineIndexes, thDistortionParam.getSearchBeginTime(), thDistortionParam.getSearchEndTime());
|
||||
thDistortionVO.setDistortion(roundHalfUp(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159)));
|
||||
//组装父级数据树
|
||||
List<THDistortionVO> treeList = getTreeData(lineIndexes, condition,userLedgerVOMap,thDistortionParam.getPowerFlag());
|
||||
List<THDistortionVO> treeList = getTreeData(lineIndexes, condition, userLedgerVOMap, thDistortionParam.getPowerFlag());
|
||||
thDistortionVO.setChildren(treeList);
|
||||
|
||||
|
||||
thDistortionVOS.add(thDistortionVO);
|
||||
}
|
||||
if(nodeType==1){
|
||||
thDistortionVOS.stream().forEach(data->{
|
||||
if(CollUtil.isNotEmpty(data.getChildren())){
|
||||
if (nodeType == 1) {
|
||||
thDistortionVOS.stream().forEach(data -> {
|
||||
if (CollUtil.isNotEmpty(data.getChildren())) {
|
||||
//市
|
||||
List<THDistortionVO> sub = data.getChildren().stream().flatMap(dto -> dto.getChildren().stream()).collect(Collectors.toList());
|
||||
sub.stream().forEach(x->{
|
||||
sub.stream().forEach(x -> {
|
||||
x.setChildren(new ArrayList<>());
|
||||
});
|
||||
data.setChildren(sub);
|
||||
@@ -124,7 +113,7 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
if (CollectionUtils.isEmpty(lineIndexes)) {
|
||||
continue;
|
||||
}
|
||||
type.add(generalDeviceDTO.getName()+"\n("+generalDeviceDTO.getLineIndexes().size()+")");
|
||||
type.add(generalDeviceDTO.getName() + "\n(" + generalDeviceDTO.getLineIndexes().size() + ")");
|
||||
List<PublicDTO> condition = getCondition(lineIndexes, thDistortionCensusParam.getSearchBeginTime(), thDistortionCensusParam.getSearchEndTime());
|
||||
single.add(roundHalfUp(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159)));
|
||||
}
|
||||
@@ -197,12 +186,12 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
*/
|
||||
private void setPowerDistortion(List<THDistortionVO> list) {
|
||||
List<THDistortionVO> result = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
list.forEach(item -> {
|
||||
List<THDistortionVO> children = item.getChildren();
|
||||
children.forEach(item2->{
|
||||
children.forEach(item2 -> {
|
||||
result.addAll(item2.getChildren());
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)){
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
item.setDistortion(roundHalfUp(result.stream().filter(child -> !Objects.equals(child.getDistortion(), 3.14159)).mapToDouble(THDistortionVO::getDistortion).average().orElse(3.14159)));
|
||||
} else {
|
||||
item.setDistortion(3.14159);
|
||||
@@ -217,7 +206,7 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
return child.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void setChildesList(List<THDistortionVO> item, List<THDistortionVO> childes,List<THDistortionVO> userList) {
|
||||
private void setChildesList(List<THDistortionVO> item, List<THDistortionVO> childes, List<THDistortionVO> userList) {
|
||||
//groupLine变电站索引和监测点集合
|
||||
Map<String, List<THDistortionVO>> groupLine;
|
||||
groupLine = childes.stream().collect(Collectors.groupingBy(thDistortionVO -> {
|
||||
@@ -225,13 +214,13 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
return pid[LineBaseEnum.SUB_LEVEL.getCode()];
|
||||
}));
|
||||
|
||||
Map<String,List<THDistortionVO>> userMap = userList.stream().collect(Collectors.groupingBy(THDistortionVO::getPid));
|
||||
Map<String, List<THDistortionVO>> userMap = userList.stream().collect(Collectors.groupingBy(THDistortionVO::getPid));
|
||||
item.forEach(thDistortionVO -> {
|
||||
List<THDistortionVO> temList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(groupLine.get(thDistortionVO.getId()))) {
|
||||
temList.addAll(groupLine.get(thDistortionVO.getId()));
|
||||
}
|
||||
if(userMap.containsKey(thDistortionVO.getId())){
|
||||
if (userMap.containsKey(thDistortionVO.getId())) {
|
||||
temList.addAll(userMap.get(thDistortionVO.getId()));
|
||||
}
|
||||
thDistortionVO.setChildren(temList);
|
||||
@@ -241,11 +230,11 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
/**
|
||||
* 获取父级每层数据
|
||||
*/
|
||||
private List<THDistortionVO> getTreeData(List<String> lineIndexes,List<PublicDTO> condition,Map<String,UserLedgerVO> userLedgerVOMap,Integer powerFlag) {
|
||||
private List<THDistortionVO> getTreeData(List<String> lineIndexes, List<PublicDTO> condition, Map<String, UserLedgerVO> userLedgerVOMap, Integer powerFlag) {
|
||||
//监测点集合
|
||||
List<THDistortionVO> monitorList = thDistortionMapper.getLineData(lineIndexes);
|
||||
Map<String, PublicDTO> map = condition.stream().collect(Collectors.toMap(PublicDTO::getId, Function.identity()));
|
||||
for(THDistortionVO thDistortionVO:monitorList) {
|
||||
for (THDistortionVO thDistortionVO : monitorList) {
|
||||
if (map.containsKey(thDistortionVO.getId())) {
|
||||
thDistortionVO.setDistortion(map.get(thDistortionVO.getId()).getData());
|
||||
}
|
||||
@@ -253,25 +242,25 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
|
||||
List<THDistortionVO> userLedgerList = new ArrayList<>();
|
||||
List<THDistortionVO> powerLedgerList = new ArrayList<>();
|
||||
if(Objects.equals(PowerFlagEnum.NO_GRID_SIDE.getCode(),powerFlag)){
|
||||
if (Objects.equals(PowerFlagEnum.NO_GRID_SIDE.getCode(), powerFlag)) {
|
||||
userLedgerList = monitorList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}else if(Objects.equals(PowerFlagEnum.GRID_SIDE.getCode(),powerFlag)){
|
||||
} else if (Objects.equals(PowerFlagEnum.GRID_SIDE.getCode(), powerFlag)) {
|
||||
powerLedgerList = monitorList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}else {
|
||||
} else {
|
||||
userLedgerList = monitorList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
powerLedgerList = monitorList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
}
|
||||
List<THDistortionVO> userTemList = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(userLedgerList)){
|
||||
Map<String,List<THDistortionVO>> objMap = userLedgerList.stream().collect(Collectors.groupingBy(THDistortionVO::getObjId));
|
||||
objMap.forEach((obj,list) -> {
|
||||
if (CollUtil.isNotEmpty(userLedgerList)) {
|
||||
Map<String, List<THDistortionVO>> objMap = userLedgerList.stream().collect(Collectors.groupingBy(THDistortionVO::getObjId));
|
||||
objMap.forEach((obj, list) -> {
|
||||
THDistortionVO thDistortionVO = new THDistortionVO();
|
||||
if (userLedgerVOMap.containsKey(obj)) {
|
||||
UserLedgerVO userLedgerVO = userLedgerVOMap.get(obj);
|
||||
thDistortionVO.setId(userLedgerVO.getId());
|
||||
thDistortionVO.setName(userLedgerVO.getProjectName());
|
||||
thDistortionVO.setPid(userLedgerVO.getStationId());
|
||||
thDistortionVO.setDistortion(list.stream().filter(it->it.getDistortion()!=3.14159).mapToDouble(THDistortionVO::getDistortion).average().orElse(3.14159));
|
||||
thDistortionVO.setDistortion(list.stream().filter(it -> it.getDistortion() != 3.14159).mapToDouble(THDistortionVO::getDistortion).average().orElse(3.14159));
|
||||
thDistortionVO.setChildren(list);
|
||||
userTemList.add(thDistortionVO);
|
||||
}
|
||||
@@ -279,16 +268,16 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
}
|
||||
|
||||
//母线集合
|
||||
// List<THDistortionVO> busBarList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
// List<THDistortionVO> busBarList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//终端集合
|
||||
//List<THDistortionVO> deviceList = thDistortionMapper.getLineInfoByList(busBarList.stream().map(THDistortionVO::getPid).distinct().collect(Collectors.toList()));
|
||||
//变电站集合
|
||||
List<THDistortionVO> substationList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(it->it.getPidS().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).distinct().collect(Collectors.toList()));
|
||||
List<THDistortionVO> substationList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(it -> it.getPidS().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).distinct().collect(Collectors.toList()));
|
||||
//供电公司集合
|
||||
List<THDistortionVO> powerCompanyList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(it->it.getPidS().split(StrUtil.COMMA)[LineBaseEnum.GD_LEVEL.getCode()]).distinct().collect(Collectors.toList()));
|
||||
List<THDistortionVO> powerCompanyList = thDistortionMapper.getLineInfoByList(monitorList.stream().map(it -> it.getPidS().split(StrUtil.COMMA)[LineBaseEnum.GD_LEVEL.getCode()]).distinct().collect(Collectors.toList()));
|
||||
|
||||
if (!CollectionUtils.isEmpty(monitorList)) {
|
||||
setChildesList(substationList, powerLedgerList,userTemList);
|
||||
setChildesList(substationList, powerLedgerList, userTemList);
|
||||
setFatherDistortion(substationList);
|
||||
powerCompanyList = powerCompanyList.stream().peek(item -> item.setChildren(getChildCategoryList(item, substationList))).collect(Collectors.toList());
|
||||
// setFatherDistortion(powerCompanyList);
|
||||
@@ -329,7 +318,7 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
|
||||
List<RMpVThd> info = rMpVThdMapper.selectList(queryWrapper);
|
||||
if (CollUtil.isNotEmpty(info)) {
|
||||
info.forEach(item->{
|
||||
info.forEach(item -> {
|
||||
PublicDTO publicDTO = new PublicDTO();
|
||||
publicDTO.setId(item.getMeasurementPointId());
|
||||
publicDTO.setData(item.getVThd());
|
||||
|
||||
Reference in New Issue
Block a user