1.解决变电站数量不统一问题
2.替换最新污染值 3.解决终端数量不一致问题
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.njcn.harmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.harmonic.api.fallback.RStatLimitRateDFeignClientFallbackFactory;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(
|
||||
value = ServerInfo.HARMONIC,
|
||||
path = "/PollutionSubstation",
|
||||
fallbackFactory = RStatLimitRateDFeignClientFallbackFactory.class,
|
||||
contextId = "PollutionSubstation")
|
||||
public interface PollutionSubstationClient {
|
||||
|
||||
@PostMapping(value ="/getSumList")
|
||||
HttpResult<Map<String, UserLinePollution>> getSumList(@RequestBody OnlineRateParam.Info param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.harmonic.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.harmonic.api.PollutionSubstationClient;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年07月21日 14:31
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PollutionSubstationClientFactory implements FallbackFactory<PollutionSubstationClient> {
|
||||
@Override
|
||||
public PollutionSubstationClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PollutionSubstationClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<Map<String, UserLinePollution>> getSumList(OnlineRateParam.Info param) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "国网上送-典型源荷指标统计数据", throwable.toString());
|
||||
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@ public class LinePollution implements Serializable {
|
||||
@ApiModelProperty("变电站")
|
||||
private String subStationName;
|
||||
|
||||
private String subStationId;
|
||||
|
||||
/**
|
||||
* 终端名称
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.harmonic.pojo.excel.pollution;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2025/12/9 21:12
|
||||
*/
|
||||
@Data
|
||||
public class UserLinePollution {
|
||||
|
||||
private String lineId;
|
||||
private Double vHarmonicValue;
|
||||
private List<User> userList;
|
||||
|
||||
@Data
|
||||
public static class User{
|
||||
private String id;
|
||||
private String projectName;
|
||||
private String stationId;
|
||||
private String lineId;
|
||||
private String city;
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,10 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
import com.njcn.harmonic.pojo.param.HarmonicPublicParam;
|
||||
import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
@@ -30,6 +32,9 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -157,4 +162,16 @@ public class PollutionSubstationController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gdPollutions, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation(value = "监测点和敏感用户谐波污染值列表")
|
||||
@PostMapping(value = "/getSumList")
|
||||
public HttpResult<Map<String, UserLinePollution>> getSumList(@RequestBody OnlineRateParam.Info param) {
|
||||
String methodDescribe = getMethodDescribe("getSumList");
|
||||
param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString());
|
||||
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString());
|
||||
List<UserLinePollution> sumList = pollutionSubstationService.getSumList(param);
|
||||
Map<String, UserLinePollution> sumMap = sumList.stream().collect(Collectors.toMap(UserLinePollution::getLineId, Function.identity()));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sumMap, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import com.njcn.device.pq.pojo.dto.PollutionGridDiagramDTO;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.GridDiagramParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
import com.njcn.harmonic.pojo.param.HarmonicPublicParam;
|
||||
import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
@@ -110,4 +112,7 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
|
||||
* @param param
|
||||
*/
|
||||
List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param);
|
||||
|
||||
|
||||
List<UserLinePollution> getSumList(OnlineRateParam.Info param);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
@@ -34,6 +35,7 @@ import com.njcn.device.pq.api.SubstationFeignClient;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.*;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.GridDiagramParam;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
@@ -128,7 +130,6 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
private final RmpEventDetailFeignClient detailFeignClient;
|
||||
private final CommLineClient commLineClient;
|
||||
|
||||
|
||||
/**
|
||||
* @param pollutionSubstationQuryParam
|
||||
* @Description: getPollutionSubstationData
|
||||
@@ -758,8 +759,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
public GridDiagramVO getPollutionAlarmData(StatSubstationBizBaseParam param) {
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getId());
|
||||
deptGetLineParam.setPowerFlag(0);
|
||||
deptGetLineParam.setLineRunFlag(0);
|
||||
deptGetLineParam.setIsUpToGrid(param.getIsUpToGrid());
|
||||
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
//获取全部变电站信息
|
||||
List<SubGetBase> collect = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).collect(Collectors.toList());
|
||||
@@ -880,25 +880,27 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
@Override
|
||||
public List<List<String>> getPollutionAlarmList(GridDiagramParam param) {
|
||||
List<List<String>> info = new ArrayList<>();
|
||||
param.getDeviceInfoParam().setPowerFlag(0);
|
||||
param.getDeviceInfoParam().setLineRunFlag(0);
|
||||
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param.getDeviceInfoParam()).getData();
|
||||
List<String> subIds = data.stream().flatMap(x -> x.getSubIndexes().stream()).collect(Collectors.toList());
|
||||
List<RStatPollutionSubstationM> substationMlist = pollutionSubstationMMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationM>()
|
||||
.select(RStatPollutionSubstationM::getSubstationId, RStatPollutionSubstationM::getValue)
|
||||
.in(CollUtil.isNotEmpty(subIds), RStatPollutionSubstationM::getSubstationId, subIds)
|
||||
.in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationM::getPollutionType, param.getIds())
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatPollutionSubstationM::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatPollutionSubstationM::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())))
|
||||
);
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getOrgId());
|
||||
deptGetLineParam.setIsUpToGrid(param.getDeviceInfoParam().getMonitorFlag());
|
||||
List<DeptGetSubStationDTO.Info> deptSub = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
List<String> lineIdList = deptSub.stream()
|
||||
.flatMap(x -> x.getStationIds().stream().flatMap(d -> d.getUnitChildrenList().stream()))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<RMpPollutionDPO> rMpPollutionDPOS = rMpPollutionDPOMapper.selectSumList(lineIdList,
|
||||
Arrays.asList("b33a2946cb2d4f2641f485cf7720ecc7"),
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
List<String> dept;
|
||||
for (GeneralDeviceDTO datum : data) {
|
||||
List<RStatPollutionSubstationM> collect = substationMlist.stream().filter(x -> datum.getSubIndexes().contains(x.getSubstationId())).collect(Collectors.toList());
|
||||
dept = new ArrayList<>();
|
||||
dept.add(datum.getName());
|
||||
dept.add(String.valueOf(datum.getSubIndexes().size()));
|
||||
dept.addAll(addList(collect));
|
||||
info.add(dept);
|
||||
for (DeptGetSubStationDTO.Info datum : deptSub) {
|
||||
if(!datum.getUnitId().equals(param.getOrgId())){
|
||||
dept = new ArrayList<>();
|
||||
dept.add(datum.getUnitName());
|
||||
dept.add(String.valueOf(datum.getStationIds().size()));
|
||||
dept.addAll(addList(rMpPollutionDPOS, datum.getStationIds()));
|
||||
info.add(dept);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
@@ -966,23 +968,26 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
|
||||
@Override
|
||||
public List<LinePollution> downPollutionLineCalc(StatSubstationBizBaseParam param) {
|
||||
List<LinePollution> finalLinePollutionList = pollutionCalcList(param);
|
||||
DeviceInfoParam deviceInfoParam=new DeviceInfoParam();
|
||||
deviceInfoParam.setLineRunFlag(0);
|
||||
deviceInfoParam.setDeptIndex(param.getId());
|
||||
deviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<GeneralDeviceDTO> data1 = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
List<String> lineIdList = data1.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<LinePollution> finalLinePollutionList = pollutionCalcList(param,lineIdList);
|
||||
// 全部监测点计算完毕后根据污染值从大到小进行排序
|
||||
finalLinePollutionList = finalLinePollutionList.stream()
|
||||
finalLinePollutionList = finalLinePollutionList.stream()
|
||||
.sorted(Comparator.comparing(LinePollution::getHarmonicValue).reversed())
|
||||
.collect(Collectors.toList());
|
||||
return finalLinePollutionList;
|
||||
return finalLinePollutionList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<LinePollution> pollutionCalcList(StatSubstationBizBaseParam param) {
|
||||
private List<LinePollution> pollutionCalcList(StatSubstationBizBaseParam param,List<String> lineIdList) {
|
||||
String startDate = param.getStartTime();
|
||||
String endDate = param.getEndTime();
|
||||
List<LinePollution> linePollutionList = new ArrayList<>();
|
||||
GridDiagramParam eventParam = new GridDiagramParam();
|
||||
List<String> lineIdList = generalDeviceInfoClient.deptGetRunLine(param.getId()).getData();
|
||||
|
||||
|
||||
eventParam.setIds(lineIdList);
|
||||
eventParam.setSearchBeginTime(param.getStartTime());
|
||||
@@ -1015,8 +1020,8 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
}
|
||||
if (CollUtil.isNotEmpty(lineIdList)) {
|
||||
// 获取谐波电压数据&总畸变率&越限限值计算基础污染值
|
||||
for (String lineId: lineIdList) {
|
||||
if(lineMap.containsKey(lineId)){
|
||||
for (String lineId : lineIdList) {
|
||||
if (lineMap.containsKey(lineId)) {
|
||||
PollutionLineInfoDTO data = lineMap.get(lineId);
|
||||
LinePollution linePollution = new LinePollution();
|
||||
// 获取暂态数据
|
||||
@@ -1026,9 +1031,9 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
BigDecimal vo2 = onlineRateMap.get(data.getDeviceId());
|
||||
linePollution.setOnlineRate(Objects.isNull(vo2) ? 0.0f : vo2.floatValue());
|
||||
//获取监测点数据完整性
|
||||
linePollution.setIntegrity(Objects.isNull(integrityMap.get(lineId)) ? 0.0 : integrityMap.get(lineId).doubleValue()>100?100.0:integrityMap.get(lineId).doubleValue());
|
||||
linePollution.setIntegrity(Objects.isNull(integrityMap.get(lineId)) ? 0.0 : integrityMap.get(lineId).doubleValue() > 100 ? 100.0 : integrityMap.get(lineId).doubleValue());
|
||||
// 计算谐波的污染值
|
||||
linePollution.setHarmonicValue(calcMap.containsKey(lineId)?calcMap.get(lineId)>100?100.0:integrityMap.get(lineId).doubleValue():0.0);
|
||||
linePollution.setHarmonicValue(calcMap.containsKey(lineId) ? calcMap.get(lineId).doubleValue() : 0.0);
|
||||
linePollution.setInterval(data.getTimeInterval());
|
||||
linePollutionList.add(linePollution);
|
||||
}
|
||||
@@ -1040,7 +1045,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
@Override
|
||||
public void downPollutionUserCalc(StatSubstationBizBaseParam param) {
|
||||
// 处理干扰源用户的报告
|
||||
List<LinePollution> loadTypeLineList = pollutionCalcList(param);
|
||||
List<LinePollution> loadTypeLineList = pollutionCalcList(param,null);
|
||||
/**
|
||||
* 1、首先过滤:重要变电站、一类变电站、跨省计量关点 todo...待优化
|
||||
* 2、过滤后,以监测对象分组统计数据有多个测点的需要出结果
|
||||
@@ -1064,7 +1069,6 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
objPollution.setObjVValue(PubUtils.doubleRound(2, objVValue) + "");
|
||||
|
||||
|
||||
|
||||
// 处理该监测对象下面监测点的信息
|
||||
List<LoadTypeLineItemPollution> loadTypeLineItemPollutions = new ArrayList<>();
|
||||
for (LinePollution linePollution : linePollutions) {
|
||||
@@ -1076,7 +1080,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
objPollutions.add(objPollution);
|
||||
}
|
||||
// 排序
|
||||
objPollutions= objPollutions.stream()
|
||||
objPollutions = objPollutions.stream()
|
||||
.sorted(Comparator.comparing(ObjPollution::getObjVValue).reversed())
|
||||
.collect(Collectors.toList());
|
||||
ExcelUtil.exportExcel("用户谐波电压污染值" + param.getEndTime() + ".xlsx", ObjPollution.class, objPollutions);
|
||||
@@ -1084,27 +1088,33 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
|
||||
@Override
|
||||
public List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param) {
|
||||
DeviceInfoParam deviceInfoParam=new DeviceInfoParam();
|
||||
deviceInfoParam.setDeptIndex(param.getId());
|
||||
deviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<GeneralDeviceDTO> data1 = generalDeviceInfoClient.getPracticalAllDeviceInfoAsSubstation(deviceInfoParam).getData();
|
||||
List<String> lineIdList = data1.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<SubstationPollution> substationPollutions = new ArrayList<>();
|
||||
// 处理干扰源用户的报告
|
||||
List<LinePollution> linePollutionList = pollutionCalcList(param);
|
||||
List<LinePollution> linePollutionList = pollutionCalcList(param,lineIdList);
|
||||
|
||||
// 以变电站分组
|
||||
Map<String, List<LinePollution>> subMap = linePollutionList.stream()
|
||||
.collect(Collectors.groupingBy(x->x.getGdName()+"_"+x.getSubStationName()+"_"+x.getSubVoltage()));
|
||||
subMap.forEach((key,value)->{
|
||||
.collect(Collectors.groupingBy(x -> x.getSubStationId()+"_"+ x.getGdName() + "_" +x.getSubStationName() + "_" + x.getSubVoltage()));
|
||||
subMap.forEach((key, value) -> {
|
||||
String[] name = key.split("_");
|
||||
SubstationPollution substationPollution = new SubstationPollution();
|
||||
substationPollution.setGdName(name[0]);
|
||||
substationPollution.setSubStationName(name[1]);
|
||||
substationPollution.setSubVoltage(name[2]);
|
||||
substationPollution.setGdName(name[1]);
|
||||
substationPollution.setSubStationName(name[2]);
|
||||
substationPollution.setSubVoltage(name[3]);
|
||||
double subVValue = value.stream()
|
||||
.mapToDouble(o -> o.getHarmonicValue())
|
||||
.average()
|
||||
.orElse(0.0);
|
||||
.sum();
|
||||
substationPollution.setSubVStationValue(PubUtils.doubleRound(2, subVValue) + "");
|
||||
List<PowerFlagPollution> lineItemPollutionList = new ArrayList<>();
|
||||
for (LinePollution linePollution : value) {
|
||||
PowerFlagPollution lineItemPollution = new PowerFlagPollution();
|
||||
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
|
||||
lineItemPollution.setVHarmonicValue(linePollution.getHarmonicValue());
|
||||
lineItemPollutionList.add(lineItemPollution);
|
||||
}
|
||||
substationPollution.setPowerFlagPollutionList(lineItemPollutionList);
|
||||
@@ -1112,30 +1122,65 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
});
|
||||
substationPollutions.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getSubVStationValue())));
|
||||
Collections.reverse(substationPollutions);
|
||||
return substationPollutions;
|
||||
return substationPollutions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserLinePollution> getSumList(OnlineRateParam.Info param) {
|
||||
List<UserLinePollution> info = new ArrayList<>();
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
userReportParam.setUserType(6);
|
||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
Map<String, List<UserLedgerVO>> userMap = userLedgerVOList.stream().filter(x -> StrUtil.isNotBlank(x.getLineId())).collect(Collectors.groupingBy(UserLedgerVO::getLineId));
|
||||
List<RMpPollutionDPO> rMpPollutionDPOS = rMpPollutionDPOMapper.selectSumList(param.getIds(), param.getDicData(), param.getStartTime(), param.getEndTime());
|
||||
Map<String, Double> pollutionMap = rMpPollutionDPOS.stream().collect(Collectors.toMap(RMpPollutionDPO::getLineId, RMpPollutionDPO::getValue));
|
||||
UserLinePollution user;
|
||||
for (String id : param.getIds()) {
|
||||
user = new UserLinePollution();
|
||||
user.setLineId(id);
|
||||
if (pollutionMap.containsKey(id)) {
|
||||
user.setVHarmonicValue(pollutionMap.get(id));
|
||||
} else {
|
||||
user.setVHarmonicValue(0.0);
|
||||
}
|
||||
List<UserLinePollution.User> userList = new ArrayList<>();
|
||||
if (userMap.containsKey(id)) {
|
||||
List<UserLedgerVO> userLedgerVOS = userMap.get(id);
|
||||
userList.addAll(BeanUtil.copyToList(userLedgerVOS, UserLinePollution.User.class));
|
||||
}
|
||||
user.setUserList(userList);
|
||||
info.add(user);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
private List<String> addList(List<RStatPollutionSubstationM> substationMlist) {
|
||||
private List<String> addList(List<RMpPollutionDPO> pollLinelist, List<SubGetBase> notNum) {
|
||||
List<String> info = new ArrayList<>();
|
||||
Integer num1 = 0;
|
||||
Integer num2 = 0;
|
||||
Integer num3 = 0;
|
||||
Integer num4 = 0;
|
||||
Integer num5 = 0;
|
||||
for (RStatPollutionSubstationM x : substationMlist) {
|
||||
Double value = x.getValue();
|
||||
//无污染 轻微污染 轻度污染 中度污染 重度污染
|
||||
if (0 <= value && value < 1) {
|
||||
num1++;
|
||||
} else if (1 <= value && value < 1.2) {
|
||||
num2++;
|
||||
} else if (1.2 <= value && value < 1.6) {
|
||||
num3++;
|
||||
} else if (1.6 <= value && value < 2) {
|
||||
num4++;
|
||||
} else if (2 <= value) {
|
||||
num5++;
|
||||
Integer num6 = 0;
|
||||
for (SubGetBase subGetBase : notNum) {
|
||||
List<RMpPollutionDPO> linePoll = pollLinelist.stream().filter(x -> subGetBase.getUnitChildrenList().contains(x.getLineId())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(linePoll)){
|
||||
Double value = linePoll.stream().mapToDouble(RMpPollutionDPO::getValue).sum();
|
||||
//无污染 轻微污染0-100 轻度污染100-1000 中度污染1000-10000 重度污染10000
|
||||
if (0 == value) {
|
||||
num1++;
|
||||
} else if (0 < value && value < 100) {
|
||||
num2++;
|
||||
} else if (100 <= value && value < 1000) {
|
||||
num3++;
|
||||
} else if (1000 <= value && value < 10000) {
|
||||
num4++;
|
||||
} else if (10000 <= value) {
|
||||
num5++;
|
||||
}
|
||||
}else{
|
||||
num6++;
|
||||
}
|
||||
}
|
||||
info.add(String.valueOf(num1));
|
||||
@@ -1143,6 +1188,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
info.add(String.valueOf(num3));
|
||||
info.add(String.valueOf(num4));
|
||||
info.add(String.valueOf(num5));
|
||||
info.add(String.valueOf(num6));
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,8 +72,6 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
|
||||
List<Dept> data = deptFeignClient.getDirectSonSelf(param.getId()).getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getId());
|
||||
deptGetLineParam.setPowerFlag(0);
|
||||
deptGetLineParam.setLineRunFlag(0);
|
||||
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
|
||||
List<String> lineIDS = deptGetChildrenMoreDTOS.stream()
|
||||
|
||||
@@ -167,7 +167,6 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
//监测点总数
|
||||
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
//在线
|
||||
param.setComFlagStatus(1);
|
||||
List<GeneralDeviceDTO> onData = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
List<String> onLine = onData.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user