Compare commits

3 Commits

Author SHA1 Message Date
wr
c38b07ec07 Merge remote-tracking branch 'origin/main' 2025-11-11 15:12:33 +08:00
wr
87f05c6278 1.提交场站评估代码 2025-11-11 14:53:51 +08:00
wr
20ec9bc0b4 1.根据专责要求调整冀北台账树 2025-11-04 17:10:46 +08:00
16 changed files with 262 additions and 202 deletions

View File

@@ -74,7 +74,10 @@ public class PollutionLineInfoDTO {
* 电压等级
*/
private String lineVoltage;
/**
* 变电站电压等级
*/
private String subVoltage;
/**
* 装置id
*/

View File

@@ -124,11 +124,11 @@ public class LineParam {
private String objId;
@ApiModelProperty(name = "bigObjType",value = "对象大类")
@NotBlank(message = "对象大类不可为空")
// @NotBlank(message = "对象大类不可为空")
private String bigObjType;
@ApiModelProperty(name = "smallObjType",value = "对象小类")
@NotBlank(message = "对象小类不可为空")
// @NotBlank(message = "对象小类不可为空")
private String smallObjType;
/**

View File

@@ -54,7 +54,7 @@ public class TerminalTreeController extends BaseController {
String methodDescribe = getMethodDescribe("getTerminalTree");
List<TerminalTree> tree;
if(isJb){
tree= terminalTreeService.getJbTerminalTree();
tree= terminalTreeService.getJbNewTerminalTree();
}else{
tree= terminalTreeService.getTerminalTree();
}

View File

@@ -49,4 +49,7 @@ public interface TerminalTreeService {
* @return
*/
List<TerminalTree> getJbTerminalTree();
List<TerminalTree> getJbNewTerminalTree();
}

View File

@@ -3,6 +3,7 @@ package com.njcn.device.pq.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -138,7 +139,12 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> lineUserList,List<TerminalTree> devOtherList,List<TerminalTree> busBarList,List<TerminalTree> devAllList,List<UserLedgerVO> userReportPOList){
List<TerminalTree> list = new ArrayList<>();
//电网侧
List<TerminalTree> devTree = devOtherList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devTree)){
list.addAll(devTree);
}
//非电网侧
if(CollUtil.isNotEmpty(userReportPOList)) {
Map<String, UserLedgerVO> userLedgerVOMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
@@ -160,6 +166,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
busCopy.setName(it.getName());
busCopy.setId(it.getId());
busCopy.setPid(it.getPid());
busCopy.setSort(it.getSort());
busCopy.setChildren(getChildren(it, lineList));
busCopy.setPowerFlag(1);
busCopy.setLevel(LineBaseEnum.SUB_V_LEVEL.getCode());
@@ -175,6 +182,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
devCopy.setName(it.getName());
devCopy.setId(it.getId());
devCopy.setPid(it.getPid());
devCopy.setSort(it.getSort());
devCopy.setChildren(getChildren(it, temBus));
devCopy.setPowerFlag(1);
devCopy.setLevel(LineBaseEnum.DEVICE_LEVEL.getCode());
@@ -192,18 +200,11 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
terminalTree.setPowerFlag(1);
terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
terminalTree.setChildren(temDevList);
terminalTree.setSort(0);
list.add(terminalTree);
});
}
List<TerminalTree> devTree = devOtherList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devTree)){
list.addAll(devTree);
}
return list;
}
@@ -521,6 +522,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
sub.setId(collect.get(0).getId());
sub.setName(collect.get(0).getName());
sub.setPid(collect.get(0).getPid());
sub.setSort(0);
sub.setChildren(valueList);
TerminalTree powerTree=new TerminalTree();
@@ -551,7 +553,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
sub.setId(child.getId());
sub.setName(child.getName());
sub.setPid(child.getPid());
sub.setSort(0);
TerminalTree powerTree=new TerminalTree();
powerTree.setName("电网侧");
powerTree.setId(child.getId());
@@ -581,7 +583,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
sub.setId(child.getId());
sub.setName(child.getName());
sub.setPid(child.getPid());
sub.setSort(0);
TerminalTree powerTree = new TerminalTree();
powerTree.setName("电网侧");
powerTree.setId(child.getId());
@@ -620,7 +622,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
sub.setId(notSub.getId());
sub.setName(notSub.getName());
sub.setPid(notSub.getPid());
sub.setSort(0);
TerminalTree powerTree = new TerminalTree();
powerTree.setId(notSub.getId());
powerTree.setName("电网侧");
@@ -655,6 +657,49 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
return taiZhang;
}
@Override
public List<TerminalTree> getJbNewTerminalTree() {
List<TerminalTree> allList = lineMapper.getAllList();
List<TerminalTree> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> provinceList = lineMapper.getProvinceList(null, 0);
List<TerminalTree> gdList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> devList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> subvList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_V_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> linepowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())&&item.getPowerFlag() != 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> lineNotPowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())&&item.getPowerFlag() == 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
subvList.forEach(subv ->{
if(CollUtil.isEmpty(subv.getChildren())){
subv.setChildren(getRecursionChildren(subv, linepowerList));
}
}
);
subvList.forEach(subv -> {
if(CollUtil.isEmpty(subv.getChildren())){
subv.setChildren(getRecursionChildren(subv, lineNotPowerList));
}
}
);
subvList.stream().filter(x-> ObjUtil.isNull(x.getPowerFlag())).forEach(x->x.setPowerFlag(0));
devList.forEach(dev -> dev.setChildren(getRecursionChildren(dev, subvList)));
devList.stream().filter(x-> ObjUtil.isNull(x.getPowerFlag())).forEach(x->x.setPowerFlag(0));
subList.forEach(sub -> sub.setChildren(getRecursionChildrenCs(sub, devList)));
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList)));
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
projectList.forEach(project -> project.setChildren(getChildren(project, provinceList)));
return projectList;
}
/**
* 获取全部子节点
@@ -663,7 +708,40 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
* @date 2021/7/19
*/
public List<TerminalTree> getChildren(TerminalTree item, List<TerminalTree> all) {
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
if(CollUtil.isNotEmpty(collect)){
long sortSize = collect.stream().filter(x->ObjUtil.isNotNull(x.getSort())).filter(x -> x.getSort() == 0).count();
if(collect.size()-sortSize/collect.size()>50){
collect.sort(Comparator.comparing(x->x.getName()));
}
}
return collect;
}
public List<TerminalTree> getRecursionChildrenCs(TerminalTree item, List<TerminalTree> all){
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> list=new ArrayList<>();
TerminalTree power=new TerminalTree();
power.setName("电网侧");
power.setSort(0);
power.setChildren(collect.stream().filter(x -> 1 != x.getPowerFlag()).collect(Collectors.toList()));
list.add(power);
TerminalTree notPower=new TerminalTree();
notPower.setName("非电网侧");
notPower.setSort(1);
notPower.setChildren(collect.stream().filter(x -> 1 == x.getPowerFlag()).collect(Collectors.toList()));
list.add(notPower);
return list;
}
public List<TerminalTree> getRecursionChildren(TerminalTree item, List<TerminalTree> all){
List<TerminalTree> list = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
if(CollUtil.isNotEmpty(list)){
item.setPowerFlag(list.get(0).getPowerFlag());
}
return list;
}
/**

View File

@@ -121,9 +121,9 @@
</if>
<if test="searchValue != '' and searchValue != null ">
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
AND sub.NAME LIKE #{searchValueLike}
AND (sub.NAME LIKE #{searchValueLike}
OR dev.name LIKE #{searchValueLike}
OR line.NAME LIKE #{searchValueLike}
OR line.NAME LIKE #{searchValueLike})
</if>
ORDER BY
gdName,
@@ -364,6 +364,7 @@
deviceDetail.login_Time AS loginTime,
deviceDetail.id deviceId,
pv.scale lineVoltage,
pqsub.scale subVoltage,
lineDetail.monitor_id monitorId
FROM
pq_line line,
@@ -372,6 +373,7 @@
pq_line device,
pq_device deviceDetail,
pq_line substation,
pq_substation pqsub,
pq_line gdinfo,
pq_voltage pv
WHERE line.id in
@@ -384,6 +386,7 @@
AND device.id = deviceDetail.id
AND device.pid = substation.id
AND substation.pid = gdinfo.id
AND substation.id = pqsub.id
AND subv.id = pv.id
</select>

View File

@@ -116,7 +116,6 @@
left join pq_substation sub on sub.id = substation.id
where device.Dev_Model = 1
and point.state = 1
and device.Run_Flag = 0
and device.Dev_Data_Type in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
@@ -125,7 +124,7 @@
and lineDetail.Power_Flag = #{powerFlag}
</if>
<if test="lineRunFlag!=null ">
and lineDetail.Run_Flag = #{lineRunFlag}
and device.Run_Flag = 0 and lineDetail.Run_Flag = #{lineRunFlag}
</if>
</select>
<select id="getLineIdByDeptIds" resultType="string">

View File

@@ -66,8 +66,9 @@
</select>
<select id="getAllList" resultType="TerminalTree">
select id, pid, name, level, sort
from pq_line
select a.id, a.pid, a.name, a.level, a.sort ,b.Power_Flag
from pq_line a
left join pq_line_detail b on a.id = b.id
where state = 1
</select>
@@ -1781,12 +1782,13 @@
</select>
<select id="selectByName" resultType="com.njcn.device.pq.pojo.po.LineDetail">
select
t2.*
t2.*,
t1.name monitorName
from
pq_line t1 ,
pq_line_detail t2
<where>
t1.id = t2.id and t2.Run_Flag=0
t1.id = t2.id
<if test="param.lineIds!=null and param.lineIds.size()!=0">
AND t1.id in
<foreach collection="param.lineIds" open="(" close=")" item="item" separator=",">

View File

@@ -799,6 +799,11 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
Optional<DictData> temp4 = voltageList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getLineVoltage())).findAny();
pollutionLineInfoDTO.setLineVoltage(temp4.map(DictData::getName).orElse(null));
// 变电站电压等级
Optional<DictData> temp5 = voltageList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getSubVoltage())).findAny();
pollutionLineInfoDTO.setSubVoltage(temp5.map(DictData::getName).orElse(null));
// 电网侧
pollutionLineInfoDTO.setPowerFlag(pollutionLineInfoDTO.getPowerFlag().equals("0") ? "电网侧" : "非电网侧");
}

View File

@@ -1,6 +1,7 @@
package com.njcn.harmonic.pojo.excel.pollution;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@@ -13,46 +14,51 @@ public class LineItemPollution implements Serializable {
* 终端名称
*/
@Excel(name = "终端名称", width = 30, replace = "/_null")
@ApiModelProperty("终端名称")
private String devName;
/**
* 终端厂家
*/
@Excel(name = "终端厂家", width = 30, replace = "/_null")
@ApiModelProperty("终端厂家")
private String manufacturer;
/**
* 终端型号
*/
@Excel(name = "终端型号", width = 30, replace = "/_null")
@ApiModelProperty("终端型号")
private String devType;
/**
* 终端投运时间
*/
@Excel(name = "投运时间", width = 30, replace = "/_null")
@ApiModelProperty("投运时间")
private String loginTime;
/**
* 监测点名称
*/
@Excel(name = "监测点名称", width = 35, replace = "/_null")
@ApiModelProperty("监测点名称")
private String lineName;
/**
* 统计间隔
*/
@Excel(name = "统计间隔", width = 30, replace = "/_null")
@ApiModelProperty("统计间隔")
private Integer interval;
/**
* 谐波电压污染值
*/
@Excel(name = "谐波电压污染值", width = 35, replace = "/_null")
@Excel(name = "谐波污染值", width = 35, replace = "/_null")
@ApiModelProperty("谐波污染值")
private Double vHarmonicValue;
@Excel(name = "谐波电压污染值", width = 35, replace = "/_null")
private Double iHarmonicValue;
/**
* 暂升次数 1.1~1.8
@@ -79,6 +85,7 @@ public class LineItemPollution implements Serializable {
* 备注
*/
@Excel(name = "备注", width = 30, replace = "/_null")
@ApiModelProperty("备注")
private String remark;
}

View File

@@ -80,6 +80,14 @@ public class LinePollution implements Serializable {
@ApiModelProperty("监测点电压等级")
private String lineVoltage;
/**
* 新增
* 监测点电压等级
*/
@Excel(name = "变电站电压等级", width = 30)
@ApiModelProperty("变电站电压等级")
private String subVoltage;
/**
* 干扰源类型
*/

View File

@@ -1,35 +1,69 @@
package com.njcn.harmonic.pojo.excel.pollution;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class PowerFlagPollution implements Serializable {
/**
* 监测点名称
*/
@Excel(name = "监测点名称", width = 35, replace = "/_null")
@ApiModelProperty("监测点名称")
private String lineName;
/**
* 终端名称
*/
@Excel(name = "终端名称", width = 30, replace = "/_null")
@ApiModelProperty("终端名称")
private String devName;
/**
* 终端厂家
*/
@Excel(name = "终端厂家", width = 30, replace = "/_null")
@ApiModelProperty("终端厂家")
private String manufacturer;
/**
* 终端型号
*/
@Excel(name = "终端型号", width = 30, replace = "/_null")
@ApiModelProperty("终端型号")
private String devType;
/**
* 终端投运时间
*/
@Excel(name = "投运时间", width = 30, replace = "/_null")
@ApiModelProperty("投运时间")
private String loginTime;
/**
* 统计间隔
*/
@Excel(name = "统计间隔", width = 30, replace = "/_null")
@ApiModelProperty("统计间隔")
private Integer interval;
/**
* 监测位置
*/
@Excel(name = "监测位置", width = 30, needMerge = true)
@ApiModelProperty("监测位置")
private String powerFlag;
/**
* 监测污染值
* 谐波电压污染值
*/
@Excel(name = "监测谐波电压污染值", width = 40, needMerge = true, replace = "/_null")
private String powerVValue;
@Excel(name = "监测谐波电流污染值", width = 40, needMerge = true, replace = "/_null")
private String powerIValue;
/**
* 当前位置下,各测点的污染数据
*/
@ExcelCollection(name = "")
private List<LineItemPollution> lineItemPollutionList;
@Excel(name = "谐波污染值", width = 35, replace = "/_null")
@ApiModelProperty("谐波污染值")
private Double vHarmonicValue;
}

View File

@@ -2,6 +2,7 @@ package com.njcn.harmonic.pojo.excel.pollution;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@@ -10,26 +11,34 @@ import java.util.List;
@Data
public class SubstationPollution implements Serializable {
/**
* 供电公司名称
*/
@Excel(name = "供电公司", width = 30, needMerge = true)
@ApiModelProperty("供电公司")
private String gdName;
/**
* 供电公司名称
*/
@Excel(name = "供电公司", width = 30, needMerge = true)
@ApiModelProperty("供电公司")
private String subVoltage;
/**
* 所属变电站
*/
@Excel(name = "变电站", width = 30, needMerge = true)
@Excel(name = "变电站电压等级", width = 30, needMerge = true)
@ApiModelProperty("变电站电压等级")
private String subStationName;
/**
* 电站污染值
*/
@Excel(name = "电站谐波电压污染值", width = 25, needMerge = true)
@Excel(name = "电站谐波污染值", width = 25, needMerge = true)
@ApiModelProperty("电站谐波污染值")
private String subVStationValue;
/**
* 电站污染值
*/
@Excel(name = "电站谐波电流污染值", width = 25, needMerge = true)
private String subIStationValue;
/**
* 电网侧&非电网侧
* name不要赋值

View File

@@ -10,6 +10,7 @@ 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.harmonic.pojo.excel.pollution.LinePollution;
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
import com.njcn.harmonic.pojo.param.HarmonicPublicParam;
import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
@@ -146,15 +147,14 @@ public class PollutionSubstationController extends BaseController {
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation(value ="导出变电站谐波电压污染值",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@GetMapping(value ="/downPollutionSubCalc",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public void downPollutionSubCalc(@RequestParam(value = "startTime") String startTime,
@RequestParam(value = "endTime") String endTime) {
StatSubstationBizBaseParam param=new StatSubstationBizBaseParam();
param.setStartTime(startTime);
param.setEndTime(endTime);
pollutionSubstationService.downPollutionSubCalc(param);
@ApiOperation(value ="变电站谐波污染值列表")
@PostMapping(value ="/downPollutionSubCalc")
public HttpResult<List<SubstationPollution>> downPollutionSubCalc(@RequestBody StatSubstationBizBaseParam param) {
String methodDescribe = getMethodDescribe("downPollutionSubCalc");
param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString());
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString());
List<SubstationPollution> gdPollutions = pollutionSubstationService.downPollutionSubCalc(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gdPollutions, methodDescribe);
}
}

View File

@@ -8,6 +8,7 @@ import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.GridDiagramParam;
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.param.HarmonicPublicParam;
import com.njcn.harmonic.pojo.param.PollutionSubstationQuryParam;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
@@ -108,5 +109,5 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
* 变电站谐波电压污染值
* @param param
*/
void downPollutionSubCalc(StatSubstationBizBaseParam param);
List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param);
}

View File

@@ -20,7 +20,6 @@ import com.njcn.device.biz.commApi.CommLineClient;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.api.StatationStatClient;
@@ -64,8 +63,6 @@ import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept;
import com.njcn.web.utils.RequestUtil;
@@ -909,21 +906,18 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
@Override
public List<SubstationVo> getSubstationInfo(String deptIndex, String searchValue, String startTime, String endTime) {
List<SubstationVo> result = new ArrayList<>();
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(deptIndex);
deptGetLineParam.setLineRunFlag(0);
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
//获取所有监测信息
List<LineDevGetDTO> lineNameList = list.stream().flatMap(x -> x.getLineBaseList().stream()).distinct().collect(Collectors.toList());
Map<String, String> lineOrgName = lineNameList.stream().collect(Collectors.toMap(LineDevGetDTO::getPointId, LineDevGetDTO::getUnitName));
deptGetLineParam.setMonitorStateRunning(false);
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
List<String> lineIds = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).flatMap(x -> x.getUnitChildrenList().stream()).distinct().collect(Collectors.toList());
//获取监测点集合
LineBaseQueryParam param = new LineBaseQueryParam();
param.setLineIds(new ArrayList<>(lineOrgName.keySet()));
param.setSearchValue(searchValue);
param.setLineIds(lineIds);
List<LineDetail> data = lineFeignClient.getByName(param).getData();
List<String> lineList = data.stream().map(LineDetail::getId).distinct().collect(Collectors.toList());
if (CollUtil.isNotEmpty(lineList)) {
//获取监测点的超标数据
List<RStatLimitRateDPO> limitRateList = rStatLimitRateDMapper.getAllOverTimes(lineList, startTime, endTime);
@@ -942,31 +936,30 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
String i = dicDataFeignClient.getDicDataByCode(DicDataEnum.I_ALL.getCode()).getData().getId();
List<RMpPollutionDPO> harmonicI = lineData.stream().filter(x -> i.equals(x.getPollutionType())).collect(Collectors.toList());
//获取监测点详细信息
Map<String, List<LineDetail>> lineDetailMap = data.stream().filter(x -> StrUtil.isNotBlank(x.getPowerSubstationName())).collect(Collectors.groupingBy(LineDetail::getPowerSubstationName));
lineDetailMap.forEach((key, value) -> {
List<SubGetBase> subNameMap = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).distinct().collect(Collectors.toList());
for (SubGetBase subGetBase : subNameMap) {
AtomicInteger alarmTime = new AtomicInteger();
SubstationVo vo = new SubstationVo();
vo.setDeptName(lineOrgName.get(value.get(0).getId()));
vo.setSubstationName(key);
List<String> gridSide = value.stream().filter(t -> Objects.equals(t.getPowerFlag(), 0)).map(LineDetail::getId).collect(Collectors.toList());
List<String> notGridSide = value.stream().filter(t -> Objects.equals(t.getPowerFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
vo.setDwLineList(lineNameList.stream().filter(x -> gridSide.contains(x.getPointId())).map(LineDevGetDTO::getPointName).sorted().collect(Collectors.toList()));
vo.setYhLineList(lineNameList.stream().filter(x -> notGridSide.contains(x.getPointId())).map(LineDevGetDTO::getPointName).sorted().collect(Collectors.toList()));
value.forEach(item -> {
if (monitorMap.containsKey(item.getId())) {
alarmTime.set(alarmTime.get() + monitorMap.get(item.getId()).getAllTime());
vo.setDeptName(subGetBase.getOrgName());
vo.setSubstationName(subGetBase.getName());
List<String> unitChildrenList = subGetBase.getUnitChildrenList();
List<LineDetail> lineDetails = data.stream().filter((x -> unitChildrenList.contains(x.getId()))).collect(Collectors.toList());
List<String> gridSide = lineDetails.stream().filter(t -> Objects.equals(t.getPowerFlag(), 0)).map(LineDetail::getId).collect(Collectors.toList());
List<String> notGridSide = lineDetails.stream().filter(t -> Objects.equals(t.getPowerFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
vo.setDwLineList(lineDetails.stream().filter(x -> gridSide.contains(x.getId())).map(LineDetail::getMonitorName).sorted().collect(Collectors.toList()));
vo.setYhLineList(lineDetails.stream().filter(x -> notGridSide.contains(x.getId())).map(LineDetail::getMonitorName).sorted().collect(Collectors.toList()));
unitChildrenList.forEach(item -> {
if (monitorMap.containsKey(item)) {
alarmTime.set(alarmTime.get() + monitorMap.get(item).getAllTime());
}
});
vo.setAlarmFreq(NumberUtil.round(alarmTime.get() * 1.0 / value.size(), 2).doubleValue());
//监测点id集合
List<String> ids = value.stream().map(LineDetail::getId).collect(Collectors.toList());
OptionalDouble maxV = harmonicV.stream().filter(x -> ids.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
vo.setAlarmFreq(NumberUtil.round(alarmTime.get() * 1.0 / unitChildrenList.size(), 2).doubleValue());
OptionalDouble maxV = harmonicV.stream().filter(x -> unitChildrenList.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
vo.setVPollutionData(maxV.isPresent() ? maxV.getAsDouble() : 0.0D);
OptionalDouble maxI = harmonicI.stream().filter(x -> ids.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
OptionalDouble maxI = harmonicI.stream().filter(x -> unitChildrenList.contains(x.getLineId())).mapToDouble(RMpPollutionDPO::getValue).max();
vo.setIPollutionData(maxI.isPresent() ? maxV.getAsDouble() : 0.0D);
result.add(vo);
});
}
}
return result;
}
@@ -1090,121 +1083,36 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
}
@Override
public void downPollutionSubCalc(StatSubstationBizBaseParam param) {
public List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param) {
List<SubstationPollution> substationPollutions = new ArrayList<>();
// 处理干扰源用户的报告
List<LinePollution> linePollutionList = pollutionCalcList(param);
// 整合变电站待导出的数据
List<GdPollution> gdPollutionList = new ArrayList<>();
// 以供电公司分组
Map<String, List<LinePollution>> gdMap = linePollutionList.stream()
.collect(Collectors.groupingBy(LinePollution::getGdName));
// 同一供电公司以变电站分组
Set<String> gdNameSet = gdMap.keySet();
for (String gdName : gdNameSet) {
// 初始化gd实体
GdPollution gdPollution = new GdPollution();
gdPollution.setGdName(gdName);
List<LinePollution> gdLinePollution = gdMap.get(gdName);
// 以变电站分组
Map<String, List<LinePollution>> subMap = gdLinePollution.stream()
.collect(Collectors.groupingBy(LinePollution::getSubStationName));
Set<String> subNameMap = subMap.keySet();
List<SubstationPollution> substationPollutions = new ArrayList<>();
for (String subName : subNameMap) {
// 初始化变电站实体
SubstationPollution substationPollution = new SubstationPollution();
substationPollution.setSubStationName(subName);
List<LinePollution> subLinePollution = subMap.get(subName);
// 需要区分电网侧、非电网侧
Map<String, List<LinePollution>> powerFlagLinePollution = subLinePollution.stream().collect(Collectors.groupingBy(LinePollution::getPowerFlag));
List<PowerFlagPollution> powerFlagPollutionList = new ArrayList<>();
// 电网侧
List<LinePollution> temp = powerFlagLinePollution.get("电网侧");
PowerFlagPollution powerFlagPollution1 = new PowerFlagPollution();
powerFlagPollution1.setPowerFlag("电网侧");
List<LineItemPollution> lineItemPollutionList1 = new ArrayList<>();
if (CollUtil.isNotEmpty(temp)) {
// 计算电网侧下所有监测点谐波电压平均污染值
double subVValue = temp.stream()
.mapToDouble(o -> o.getHarmonicValue())
.average()
.orElse(0.0);
// 电网侧污染值
powerFlagPollution1.setPowerVValue(PubUtils.doubleRound(2, subVValue) + "");
// 设备信息
for (LinePollution linePollution : temp) {
LineItemPollution lineItemPollution = new LineItemPollution();
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
lineItemPollutionList1.add(lineItemPollution);
}
} else {
// 仅有非电网侧时,电网侧赋予空置
LineItemPollution lineItemPollution = new LineItemPollution();
lineItemPollutionList1.add(lineItemPollution);
}
// 设备信息注入监测位置对象中
powerFlagPollution1.setLineItemPollutionList(lineItemPollutionList1);
powerFlagPollutionList.add(powerFlagPollution1);
// 非电网侧
List<LinePollution> temp1 = powerFlagLinePollution.get("非电网侧");
PowerFlagPollution powerFlagPollution2 = new PowerFlagPollution();
powerFlagPollution2.setPowerFlag("非电网侧");
List<LineItemPollution> lineItemPollutionList2 = new ArrayList<>();
if (CollUtil.isNotEmpty(temp1)) {
// 计算电网侧下所有监测点谐波电压平均污染值
double subVValue = temp1.stream()
.mapToDouble(o -> o.getHarmonicValue())
.average()
.orElse(0.0);
// 电网侧污染值
powerFlagPollution2.setPowerVValue(PubUtils.doubleRound(2, subVValue) + "");
// 电网侧污染值
for (LinePollution linePollution : temp1) {
LineItemPollution lineItemPollution = new LineItemPollution();
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
lineItemPollutionList2.add(lineItemPollution);
}
} else {
// 仅有非电网侧时,电网侧赋予空置
LineItemPollution lineItemPollution = new LineItemPollution();
lineItemPollutionList2.add(lineItemPollution);
}
// 设备信息注入监测位置对象中
powerFlagPollution2.setLineItemPollutionList(lineItemPollutionList2);
powerFlagPollutionList.add(powerFlagPollution2);
substationPollution.setPowerFlagPollutionList(powerFlagPollutionList);
// 如果电网侧有污染值,就作为变电站的污染值,否则就用非电网侧的污染值作为该变电站污染值
if (Objects.nonNull(powerFlagPollution1.getPowerVValue())) {
substationPollution.setSubVStationValue(powerFlagPollution1.getPowerVValue());
} else {
substationPollution.setSubVStationValue(powerFlagPollution2.getPowerVValue());
}
if (Objects.nonNull(powerFlagPollution1.getPowerIValue())) {
substationPollution.setSubIStationValue(powerFlagPollution1.getPowerIValue());
} else {
substationPollution.setSubIStationValue(powerFlagPollution2.getPowerIValue());
}
substationPollutions.add(substationPollution);
// 变电站分组
Map<String, List<LinePollution>> subMap = linePollutionList.stream()
.collect(Collectors.groupingBy(x->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]);
double subVValue = value.stream()
.mapToDouble(o -> o.getHarmonicValue())
.average()
.orElse(0.0);
substationPollution.setSubVStationValue(PubUtils.doubleRound(2, subVValue) + "");
List<PowerFlagPollution> lineItemPollutionList = new ArrayList<>();
for (LinePollution linePollution : value) {
PowerFlagPollution lineItemPollution = new PowerFlagPollution();
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
lineItemPollutionList.add(lineItemPollution);
}
// 针对这个供电公司下的变电站污染值排序
substationPollutions.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getSubVStationValue())));
Collections.reverse(substationPollutions);
// List<SubstationPollution> finalSubstation = substationPollutions.stream().sorted((Comparator.comparingDouble(SubstationPollution::getSubStationValue))
// .reversed())
// .collect(Collectors.toList());
gdPollution.setSubstationPollutionList(substationPollutions);
gdPollutionList.add(gdPollution);
}
ExcelUtil.exportExcel("变电站谐波电压污染值" + param.getEndTime() + ".xlsx", GdPollution.class, gdPollutionList);
substationPollution.setPowerFlagPollutionList(lineItemPollutionList);
substationPollutions.add(substationPollution);
});
substationPollutions.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getSubVStationValue())));
Collections.reverse(substationPollutions);
return substationPollutions;
}