1.完善稳态指标符合性占比树形结构
2.完成终端评价和异常终端详情联调
This commit is contained in:
@@ -18,8 +18,8 @@ import java.util.List;
|
||||
@ApiModel
|
||||
public class DevRunEvaluateParam {
|
||||
|
||||
@ApiModelProperty(name = "orgId", value = "部门id")
|
||||
private String orgId;
|
||||
@ApiModelProperty(name = "deptIndex", value = "部门id")
|
||||
private String deptIndex;
|
||||
|
||||
/**
|
||||
* 0-电网侧
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.device.pq.pojo.param;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.biz.enums.LineFlagEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -16,6 +17,7 @@ import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -30,11 +32,11 @@ public class DeviceInfoParam implements Serializable {
|
||||
/**
|
||||
* 统计类型
|
||||
*/
|
||||
@ApiModelProperty(name = "statisticalType", value = "统计类型",required = true)
|
||||
@ApiModelProperty(name = "statisticalType", value = "统计类型", required = true)
|
||||
@NotNull(message = "统计类型不可为空")
|
||||
private SimpleDTO statisticalType;
|
||||
|
||||
@ApiModelProperty(name = "deptIndex", value = "部门索引",required = true)
|
||||
@ApiModelProperty(name = "deptIndex", value = "部门索引", required = true)
|
||||
@NotBlank(message = "部门索引不可为空")
|
||||
private String deptIndex;
|
||||
|
||||
@@ -102,8 +104,10 @@ public class DeviceInfoParam implements Serializable {
|
||||
@ApiModelProperty("监测点运行状态")
|
||||
@Range(min = 0, max = 2, message = "监测点运行状态" + ValidMessage.PARAM_FORMAT_ERROR)
|
||||
private Integer lineRunFlag;
|
||||
|
||||
/**
|
||||
* 默认全部监测点
|
||||
*
|
||||
* @param deptIndex 部门索引
|
||||
* @param serverName 服务名
|
||||
*/
|
||||
@@ -117,6 +121,7 @@ public class DeviceInfoParam implements Serializable {
|
||||
|
||||
/**
|
||||
* 默认全部监测点
|
||||
*
|
||||
* @param deptIndex 部门索引
|
||||
* @param serverName 服务名
|
||||
*/
|
||||
@@ -147,7 +152,7 @@ public class DeviceInfoParam implements Serializable {
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class BusinessParam extends DeviceInfoParam{
|
||||
public static class BusinessParam extends DeviceInfoParam {
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
||||
@@ -168,7 +173,7 @@ public class DeviceInfoParam implements Serializable {
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class CompareBusinessParam extends BusinessParam{
|
||||
public static class CompareBusinessParam extends BusinessParam {
|
||||
|
||||
@ApiModelProperty("比较开始时间")
|
||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
||||
@@ -182,7 +187,7 @@ public class DeviceInfoParam implements Serializable {
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class CompareLimitParam extends BusinessParam{
|
||||
public static class CompareLimitParam extends BusinessParam {
|
||||
|
||||
@ApiModelProperty("查询条数")
|
||||
@NotNull(message = " 查询条数查询条数不能为空")
|
||||
@@ -192,7 +197,7 @@ public class DeviceInfoParam implements Serializable {
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class GridDiagram extends BusinessParam{
|
||||
public static class GridDiagram extends BusinessParam {
|
||||
|
||||
@ApiModelProperty("查询总数监测点")
|
||||
private List<String> coutList;
|
||||
@@ -201,7 +206,13 @@ public class DeviceInfoParam implements Serializable {
|
||||
private List<String> alarmList;
|
||||
|
||||
@ApiModelProperty("是否是冀北电网一张图树 0:否 1:是")
|
||||
private Integer type=0;
|
||||
private Integer type = 0;
|
||||
}
|
||||
|
||||
public Boolean isUserLedger() {
|
||||
if (Objects.isNull(this.powerFlag) || !PowerFlagEnum.GRID_SIDE.getCode().equals(this.powerFlag)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,9 @@ package com.njcn.device.pq.pojo.po;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -33,8 +27,14 @@ public class RStatIntegrityD {
|
||||
@MppMultiId
|
||||
private String lineIndex;
|
||||
|
||||
/**
|
||||
* 应收数量
|
||||
*/
|
||||
private Integer dueTime;
|
||||
|
||||
/**
|
||||
* 实收数量
|
||||
*/
|
||||
private Integer realTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
@@ -19,6 +19,7 @@ public class DeviceRunEvaluateVO {
|
||||
|
||||
@ApiModelProperty("变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty("评价")
|
||||
private BigDecimal evaluate;
|
||||
|
||||
|
||||
@@ -1853,7 +1853,7 @@
|
||||
AND t.id = td.id
|
||||
AND dev.id = subv.pid
|
||||
AND sub.id = dev.pid
|
||||
<if test="powerFlag!=null ">
|
||||
<if test="powerFlag!=null and powerFlag!=2">
|
||||
AND td.Power_Flag =#{powerFlag}
|
||||
</if>
|
||||
<if test="lineIds!=null and lineIds.size()!=0">
|
||||
|
||||
@@ -115,7 +115,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (CollUtil.isNotEmpty(integrityDS)) {
|
||||
double realTime = integrityDS.stream().mapToDouble(RStatIntegrityD::getRealTime).sum();
|
||||
double dueTime = integrityDS.stream().mapToDouble(RStatIntegrityD::getDueTime).sum();
|
||||
evaluateVO.setIntegrityRate(NumberUtil.round(realTime * 100 / dueTime, 2));
|
||||
evaluateVO.setIntegrityRate(NumberUtil.round(Math.min(realTime * 100 / dueTime,100), 2));
|
||||
} else {
|
||||
evaluateVO.setIntegrityRate(new BigDecimal(0));
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (CollUtil.isNotEmpty(onlineRateDS)) {
|
||||
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlinerateD::getOnlineMin).sum();
|
||||
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlinerateD::getOfflineMin).sum();
|
||||
evaluateVO.setOnLineRate(NumberUtil.round(onlineTime * 100.0 / (onlineTime + offlineTime), 2));
|
||||
evaluateVO.setOnLineRate(NumberUtil.round(Math.min(onlineTime * 100.0 / (onlineTime + offlineTime),100), 2));
|
||||
} else {
|
||||
evaluateVO.setOnLineRate(new BigDecimal(0));
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (allTime == 0) {
|
||||
evaluateVO.setPassRate(new BigDecimal(0));
|
||||
} else {
|
||||
evaluateVO.setPassRate(NumberUtil.round((1 - (overTime * 1.0 / allTime)) * 100, 2));
|
||||
evaluateVO.setPassRate(NumberUtil.round(Math.min((1 - (overTime * 1.0 / allTime)) * 100,100), 2));
|
||||
}
|
||||
} else {
|
||||
evaluateVO.setPassRate(new BigDecimal(0));
|
||||
@@ -180,7 +180,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
@Override
|
||||
public List<DeviceRunEvaluateVO> getRunEvaluateDetail(DevRunEvaluateParam param) {
|
||||
List<DeviceRunEvaluateVO> info = new ArrayList<>();
|
||||
List<DevDetailVO> devDetailVOList = deptLineService.getLineDetailByDeptIdAndDevIds(param.getOrgId(), param.getPowerFlag(), param.getIds());
|
||||
List<DevDetailVO> devDetailVOList = deptLineService.getLineDetailByDeptIdAndDevIds(param.getDeptIndex(), param.getPowerFlag(), param.getIds());
|
||||
if (CollUtil.isNotEmpty(devDetailVOList)) {
|
||||
List<RStatLimitRateDPO> limitRateList = new ArrayList<>();
|
||||
List<RStatOnlinerateD> onlineRateList = new ArrayList<>();
|
||||
|
||||
@@ -8,7 +8,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.api.AlarmClient;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
@@ -28,17 +27,13 @@ import com.njcn.device.pq.pojo.vo.LineIntegrityDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
|
||||
import com.njcn.device.pq.service.LineIntegrityDataService;
|
||||
import com.njcn.device.pq.utils.DataStatisticsUtil;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
|
||||
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -90,9 +85,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
||||
|
||||
// 判断所有数据集合状态
|
||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
||||
|
||||
Map<String, UserLedgerVO> userLedgerVOMap;
|
||||
if (Objects.isNull(lineIntegrityDataParam.getPowerFlag()) || !PowerFlagEnum.GRID_SIDE.getCode().equals(lineIntegrityDataParam.getPowerFlag())) {
|
||||
if (lineIntegrityDataParam.isUserLedger()) {
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
} else {
|
||||
|
||||
@@ -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();
|
||||
Map<String, UserLedgerVO> userMap = new HashMap<>();
|
||||
if (steadyParam.isUserLedger()) {
|
||||
List<UserLedgerVO> userLedgerList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
Map<String, UserLedgerVO> userMap = userLedgerList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
userMap.putAll(userLedgerList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity())));
|
||||
}
|
||||
|
||||
//按照条件获取实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> deviceDataList = generalDeviceInfoClient.getPracticalRunDeviceInfo(steadyParam).getData();
|
||||
@@ -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);
|
||||
}
|
||||
@@ -283,12 +272,12 @@ public class THDistortionServiceImpl implements THDistortionService {
|
||||
//终端集合
|
||||
//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