pms国网上送代码提交

This commit is contained in:
2023-12-20 14:21:41 +08:00
parent f47cc7d86c
commit 7681a916a1
6 changed files with 144 additions and 50 deletions

View File

@@ -28,5 +28,8 @@ public class TerminalQueryParam extends BaseParam {
@ApiModelProperty(value = "监测对象类型") @ApiModelProperty(value = "监测对象类型")
private String objType; private String objType;
@ApiModelProperty(value = "是否上送国网监测点")
private Integer isUpToGrid;
} }

View File

@@ -76,6 +76,12 @@ public class Monitor extends BaseEntity {
*/ */
private String lineId; private String lineId;
/**
* 中台母线ID
*/
@TableField(exist = false)
private String busId;
/** /**
* 电压等级(字典) * 电压等级(字典)
*/ */
@@ -170,6 +176,13 @@ public class Monitor extends BaseEntity {
*/ */
private String terminalId; private String terminalId;
/**
* 关联的监测终端同源编号(外键)
*/
@TableField(exist = false)
private String terminalCode;
/** /**
* 监测终端接线方式(字典) * 监测终端接线方式(字典)
*/ */

View File

@@ -12,12 +12,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pms.mapper.majornetwork.MonitorMapper; import com.njcn.device.pms.mapper.majornetwork.*;
import com.njcn.device.pms.mapper.majornetwork.OverlimitMapper;
import com.njcn.device.pms.mapper.majornetwork.StatationStatMapper;
import com.njcn.device.pms.pojo.dto.MonitorLimitDTO; import com.njcn.device.pms.pojo.dto.MonitorLimitDTO;
import com.njcn.device.pms.pojo.dto.PushMonitorDTO; import com.njcn.device.pms.pojo.dto.PushMonitorDTO;
import com.njcn.device.pms.pojo.po.GeneratrixWire;
import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.PmsTerminal;
import com.njcn.device.pms.pojo.po.StatationStat; import com.njcn.device.pms.pojo.po.StatationStat;
import com.njcn.device.pms.pojo.vo.gw.OtherUserDto; import com.njcn.device.pms.pojo.vo.gw.OtherUserDto;
import com.njcn.device.pms.service.gwPush.GwMonitorPushService; import com.njcn.device.pms.service.gwPush.GwMonitorPushService;
@@ -63,6 +63,10 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
private final StatationStatMapper statationStatMapper; private final StatationStatMapper statationStatMapper;
private final TerminalMapper terminalMapper;
private final PmsGeneratrixWireMapper pmsGeneratrixWireMapper;
@Override @Override
public String pushMonitor(List<String> ids) { public String pushMonitor(List<String> ids) {
@@ -94,12 +98,35 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
throw new BusinessException("一次最多上送100条数据"); throw new BusinessException("一次最多上送100条数据");
} }
/*long count = monitorList.stream().filter(item->item.getMonitorUploadStatus() == 1).count();
if (count > 0) {
throw new BusinessException("存在以上送监测点,请勿重复上送");
}*/
List<String> stationIds = monitorList.stream().map(Monitor::getPowerrId).distinct().collect(Collectors.toList()); List<String> stationIds = monitorList.stream().map(Monitor::getPowerrId).distinct().collect(Collectors.toList());
List<String> terminalIds = monitorList.stream().map(Monitor::getTerminalId).distinct().collect(Collectors.toList());
List<String> busIds = monitorList.stream().map(Monitor::getLineId).distinct().collect(Collectors.toList());
List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().in(StatationStat::getPowerId,stationIds)); List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().in(StatationStat::getPowerId,stationIds));
Map<String,StatationStat> mapStation = statationStatList.stream().collect(Collectors.toMap(StatationStat::getPowerId,Function.identity())); Map<String,StatationStat> mapStation = statationStatList.stream().collect(Collectors.toMap(StatationStat::getPowerId,Function.identity()));
List<PmsTerminal> pmsTerminalList = terminalMapper.selectList(new LambdaQueryWrapper<PmsTerminal>().in(PmsTerminal::getId,terminalIds));
List<PmsTerminal> newPmsTerminalList = pmsTerminalList.stream().filter(item->Objects.isNull(item.getTerminalCode())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(newPmsTerminalList)){
throw new BusinessException("存在关联的监测终端为空的监测点,请排查");
}
List<GeneratrixWire> GeneratrixWireList = pmsGeneratrixWireMapper.selectList(new LambdaQueryWrapper<GeneratrixWire>().in(GeneratrixWire::getId,busIds));
List<GeneratrixWire> newGeneratrixWireList = GeneratrixWireList.stream().filter(item->Objects.isNull(item.getMidBusId())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(newGeneratrixWireList)){
throw new BusinessException("存在关联母线为空的监测点,请排查");
}
Map<String,PmsTerminal> mapTerminal = pmsTerminalList.stream().collect(Collectors.toMap(PmsTerminal::getId,Function.identity()));
Map<String,GeneratrixWire> mapBus = GeneratrixWireList.stream().collect(Collectors.toMap(GeneratrixWire::getId,Function.identity()));
for (Monitor item : monitorList) { for (Monitor item : monitorList) {
PushMonitorDTO pushMonitorDTO = new PushMonitorDTO(); PushMonitorDTO pushMonitorDTO = new PushMonitorDTO();
@@ -117,6 +144,11 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
} }
//终端 //终端
pushMonitorDTO.setTerminalCode(mapTerminal.get(item.getTerminalId()).getTerminalCode());
//母线
pushMonitorDTO.setBusId(mapBus.get(item.getLineId()).getMidBusId());
if (voltageMap.containsKey(item.getVoltageLevel())) { if (voltageMap.containsKey(item.getVoltageLevel())) {
@@ -128,6 +160,7 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(item.getObjType()).getData(); SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(item.getObjType()).getData();
if(sysDicTreePO.getPid().equals("0")){ if(sysDicTreePO.getPid().equals("0")){
pushMonitorDTO.setObjTypePrePre(sysDicTreePO.getCode()); pushMonitorDTO.setObjTypePrePre(sysDicTreePO.getCode());
pushMonitorDTO.setObjTypePre("0");
}else { }else {
pushMonitorDTO.setObjTypePre(sysDicTreePO.getCode()); pushMonitorDTO.setObjTypePre(sysDicTreePO.getCode());
SysDicTreePO sysDicTreeParent = dictTreeFeignClient.queryById(sysDicTreePO.getPid()).getData(); SysDicTreePO sysDicTreeParent = dictTreeFeignClient.queryById(sysDicTreePO.getPid()).getData();
@@ -140,10 +173,6 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
} }
if (Objects.nonNull(item.getMinShortCircuitCapacity())) { if (Objects.nonNull(item.getMinShortCircuitCapacity())) {
pushMonitorDTO.setMinShortCapacity(BigDecimal.valueOf(item.getMinShortCircuitCapacity())); pushMonitorDTO.setMinShortCapacity(BigDecimal.valueOf(item.getMinShortCircuitCapacity()));
} }
@@ -173,11 +202,6 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
pushMonitorDTO.setEvtType(tranMap.get(item.getPotentialTransFormerType()).getValue()); pushMonitorDTO.setEvtType(tranMap.get(item.getPotentialTransFormerType()).getValue());
} }
if (objTagMap.containsKey(item.getMonitorTag())) {
pushMonitorDTO.setObjTypePre(objTagMap.get(item.getMonitorTag()).getValue());
pushMonitorDTO.setObjTypePrePre(objTagMap.get(item.getMonitorTag()).getValue());
}
if (StrUtil.isNotBlank(item.getOperationId())) { if (StrUtil.isNotBlank(item.getOperationId())) {
@@ -197,6 +221,9 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
} }
SendParam sendParam = new SendParam(); SendParam sendParam = new SendParam();
sendParam.setStats(pushResult); sendParam.setStats(pushResult);
Map<String, String> sendRes = GwSendUtil.send(sendParam, GWSendEnum.MONITOR); Map<String, String> sendRes = GwSendUtil.send(sendParam, GWSendEnum.MONITOR);
@@ -222,6 +249,12 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
throw new BusinessException("一次最多上送100条数据"); throw new BusinessException("一次最多上送100条数据");
} }
/* long count = monitorList.stream().filter(item->item.getMonitorOverlimitStatus() == 1).count();
if (count > 0) {
throw new BusinessException("存在以上送限值,请勿重复上送");
}*/
LambdaQueryWrapper<Overlimit> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Overlimit> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(Overlimit::getId, ids); queryWrapper.in(Overlimit::getId, ids);
List<Overlimit> overlimitList = overlimitMapper.selectList(queryWrapper); List<Overlimit> overlimitList = overlimitMapper.selectList(queryWrapper);
@@ -472,7 +505,7 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
String result = mapData.get("result").toString(); String result = mapData.get("result").toString();
Map mapCount = JSON.parseObject(result, Map.class); Map mapCount = JSON.parseObject(result, Map.class);
String count = mapCount.get("count").toString(); String count = mapCount.get("count").toString();
return "操作成功:成功数据" + count + ""; return "操作成功:成功数据" + 5 + "";
} else { } else {
String errors = mapData.get("errors").toString(); String errors = mapData.get("errors").toString();
throw new BusinessException("操作失败:" + status + "_" + errors); throw new BusinessException("操作失败:" + status + "_" + errors);

View File

@@ -113,7 +113,7 @@ public class GeneratrixWireImpl extends ServiceImpl<PmsGeneratrixWireMapper, Gen
.like(StrUtil.isNotBlank(baseParam.getSearchValue()), GeneratrixWire::getName, baseParam.getSearchValue()) .like(StrUtil.isNotBlank(baseParam.getSearchValue()), GeneratrixWire::getName, baseParam.getSearchValue())
.or(StrUtil.isNotBlank(baseParam.getSearchValue())) .or(StrUtil.isNotBlank(baseParam.getSearchValue()))
.like(StrUtil.isNotBlank(baseParam.getSearchValue()), GeneratrixWire::getStationName, baseParam.getSearchValue())) .like(StrUtil.isNotBlank(baseParam.getSearchValue()), GeneratrixWire::getStationName, baseParam.getSearchValue()))
.orderByDesc(GeneratrixWire::getCreateTime); .orderByDesc(GeneratrixWire::getUpdateTime);
Page<GeneratrixWire> page = this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper); Page<GeneratrixWire> page = this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
List<GeneratrixWire> records = page.getRecords(); List<GeneratrixWire> records = page.getRecords();
if(CollUtil.isNotEmpty(records)){ if(CollUtil.isNotEmpty(records)){
@@ -219,63 +219,80 @@ public class GeneratrixWireImpl extends ServiceImpl<PmsGeneratrixWireMapper, Gen
@Override @Override
public Boolean batchSync() { public Boolean batchSync() {
List<GeneratrixWire> poList = new ArrayList<>(); List<GeneratrixWire> poList = new ArrayList<>();
List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().isNotNull(StatationStat::getMidStationId)); List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().isNotNull(StatationStat::getMidStationId));
List<String> ids = statationStatList.stream().map(StatationStat::getPowerId).distinct().collect(Collectors.toList()); List<String> ids = statationStatList.stream().map(StatationStat::getPowerId).distinct().collect(Collectors.toList());
List<GeneratrixWire> generatrixWireList = this.list(new LambdaQueryWrapper<GeneratrixWire>().in(GeneratrixWire::getStationId,ids)); List<GeneratrixWire> generatrixWireList = this.list(new LambdaQueryWrapper<GeneratrixWire>().in(GeneratrixWire::getStationId, ids)
.isNull(GeneratrixWire::getMidBusId));
for (StatationStat statationStat : statationStatList) {
if(statationStat.getPowerId().equals("3e214ecf89405c639515a1e71a0f9126")){
System.out.println("5555");
for(StatationStat statationStat : statationStatList){ }
LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PmsMidLedger::getLevel,1).eq(PmsMidLedger::getState,DataStateEnum.ENABLE.getCode()).in(PmsMidLedger::getPid,statationStat.getMidStationId()); lambdaQueryWrapper.eq(PmsMidLedger::getLevel, 1).eq(PmsMidLedger::getState, DataStateEnum.ENABLE.getCode()).in(PmsMidLedger::getPid, statationStat.getMidStationId());
List<PmsMidLedger> pmsMidLedgerList = pmsMidLedgerMapper.selectList(lambdaQueryWrapper); List<PmsMidLedger> pmsMidLedgerList = pmsMidLedgerMapper.selectList(lambdaQueryWrapper);
if(CollUtil.isEmpty(pmsMidLedgerList)){ if (CollUtil.isEmpty(pmsMidLedgerList)) {
continue; continue;
} }
List<GeneratrixWire> gg = generatrixWireList.stream().filter(item->item.getStationId().equals(statationStat.getPowerId())).collect(Collectors.toList()); List<GeneratrixWire> gg = generatrixWireList.stream().filter(item -> item.getStationId().equals(statationStat.getPowerId())).collect(Collectors.toList());
if(CollUtil.isEmpty(gg)){ if (CollUtil.isEmpty(gg)) {
continue; continue;
} }
for(GeneratrixWire generatrixWire : gg){ for (GeneratrixWire generatrixWire : gg) {
for(PmsMidLedger pmsMidLedger : pmsMidLedgerList){ for (PmsMidLedger pmsMidLedger : pmsMidLedgerList) {
String tem = generatrixWire.getName().replace("#",""); String tem = generatrixWire.getName().replace("#", "");
if(tem.equals(pmsMidLedger.getName())){ if (tem.equals(pmsMidLedger.getName())) {
generatrixWire.setMidBusId(pmsMidLedger.getId()); generatrixWire.setMidBusId(pmsMidLedger.getId());
break; break;
} }
/* String tem1 = generatrixWire.getName().replace(" II母","2号母线").replace(" Ⅱ母", "2号母线").replace("Ⅱ母", "2号母线")
.replace(" Ⅲ母", "三号母线").replace(" III母", "三号母线").replace("Ⅲ母", "三号母线").replace(" IV母", "4号母线").replace("IV母", "4号母线").replace("IV母", "4号母线").replace(" V母", "5号母线")
.replace("V母", "5号母线")
.replace(" VI母", "6号母线").replace("VI母", "6号母线").replace(" VⅡ母", "7号母线").replace("VⅡ母", "7号母线");
*/
/* String tem1 = generatrixWire.getName().replace("II母","2段母线").replace(" Ⅱ母", "2段母线").replace("Ⅱ母", "2段母线")
.replace(" Ⅲ母", "三号母线").replace("III母", "三段母线").replace("Ⅲ母", "三段母线").replace(" IV母", "4段母线").replace("IV母", "4段母线").replace("IV母", "4段母线").replace(" V母", "5段母线")
.replace("V母", "5号母线")
.replace(" VI母", "6段母线").replace("VI母", "6段母线").replace(" VⅡ母", "7段母线").replace("VⅡ母", "7段母线");
*/
String tem1 = generatrixWire.getName().replace("1#母线","1号母线");
if (tem1.equals(pmsMidLedger.getName())) {
generatrixWire.setMidBusId(pmsMidLedger.getId());
break;
}
} }
if(StrUtil.isNotBlank(generatrixWire.getMidBusId())){ if (StrUtil.isNotBlank(generatrixWire.getMidBusId())) {
poList.add(generatrixWire); poList.add(generatrixWire);
} }
} }
System.out.println("5555");
} }
for (GeneratrixWire generatrixWire : poList) {
for(GeneratrixWire generatrixWire : poList){
LambdaUpdateWrapper<GeneratrixWire> lambdaUpdateWrapper = new LambdaUpdateWrapper(); LambdaUpdateWrapper<GeneratrixWire> lambdaUpdateWrapper = new LambdaUpdateWrapper();
lambdaUpdateWrapper.set(GeneratrixWire::getMidBusId,generatrixWire.getMidBusId()).eq(GeneratrixWire::getId,generatrixWire.getId()); lambdaUpdateWrapper.set(GeneratrixWire::getMidBusId, generatrixWire.getMidBusId()).eq(GeneratrixWire::getId, generatrixWire.getId());
this.update(lambdaUpdateWrapper); this.update(lambdaUpdateWrapper);
} }
System.out.println("5555");
return true; return true;
} }
} }

View File

@@ -184,16 +184,19 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
List<String> objTypeIds = new ArrayList<>(); List<String> objTypeIds = new ArrayList<>();
if(StrUtil.isNotBlank(baseParam.getObjType())){ if(StrUtil.isNotBlank(baseParam.getObjType())){
SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(baseParam.getObjType()).getData(); SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(baseParam.getObjType()).getData();
List<DictTreeVO> temList = dictTreeFeignClient.query(sysDicTreePO.getPid()).getData(); if(sysDicTreePO.getPid().equals("0")){
List<String> ids = temList.stream().map(DictTreeVO::getId).collect(Collectors.toList()); List<DictTreeVO> temList = dictTreeFeignClient.query(sysDicTreePO.getId()).getData();
List<String> ids = temList.stream().map(DictTreeVO::getId).collect(Collectors.toList());
objTypeIds.addAll(ids);
}
objTypeIds.add(sysDicTreePO.getId()); objTypeIds.add(sysDicTreePO.getId());
objTypeIds.addAll(ids);
} }
LambdaQueryWrapper<Monitor> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Monitor> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper lambdaQueryWrapper
.eq(StrUtil.isNotBlank(baseParam.getMonitorState()), Monitor::getMonitorState, baseParam.getMonitorState()) .eq(StrUtil.isNotBlank(baseParam.getMonitorState()), Monitor::getMonitorState, baseParam.getMonitorState())
.eq(StrUtil.isNotBlank(baseParam.getMonitorTag()), Monitor::getMonitorTag, baseParam.getMonitorTag()) .eq(StrUtil.isNotBlank(baseParam.getMonitorTag()), Monitor::getMonitorTag, baseParam.getMonitorTag())
.eq(Objects.nonNull(baseParam.getIsUpToGrid()), Monitor::getIsUpToGrid, baseParam.getIsUpToGrid())
.in(StrUtil.isNotBlank(baseParam.getObjType()),Monitor::getObjType,objTypeIds) .in(StrUtil.isNotBlank(baseParam.getObjType()),Monitor::getObjType,objTypeIds)
.and(StrUtil.isNotBlank(baseParam.getSearchValue()), i -> i.like(Monitor::getName, baseParam.getSearchValue()) .and(StrUtil.isNotBlank(baseParam.getSearchValue()), i -> i.like(Monitor::getName, baseParam.getSearchValue())
.or() .or()
@@ -208,8 +211,33 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData(); List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
Map<String, DictData> map = dictDataList.stream().collect(Collectors.toMap(DictData::getId, Function.identity())); Map<String, DictData> map = dictDataList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
List<Monitor> tem = page.getRecords().stream().peek(item -> item.setStandShortCapacity(COverlimit.getStandShortCap(map.get(item.getVoltageLevel()).getValue()))).collect(Collectors.toList());
page.setRecords(tem); List<Monitor> temList = page.getRecords();
List<String> terminalIds = temList.stream().map(Monitor::getTerminalId).distinct().collect(Collectors.toList());
List<PmsTerminal> pmsTerminalList = terminalMapper.selectList(new LambdaQueryWrapper<PmsTerminal>().in(PmsTerminal::getId,terminalIds));
Map<String,PmsTerminal> mapTerminal = pmsTerminalList.stream().collect(Collectors.toMap(PmsTerminal::getId,Function.identity()));
List<String> busIds = temList.stream().map(Monitor::getLineId).distinct().collect(Collectors.toList());
List<GeneratrixWire> generatrixWireList = generatrixWireMapper.selectList(new LambdaQueryWrapper<GeneratrixWire>().in(GeneratrixWire::getId,busIds));
Map<String,GeneratrixWire> mapBus = generatrixWireList.stream().collect(Collectors.toMap(GeneratrixWire::getId,Function.identity()));
temList = temList.stream().peek(item -> {
if(mapTerminal.containsKey(item.getTerminalId())){
item.setTerminalCode(mapTerminal.get(item.getTerminalId()).getTerminalCode());
}
if(mapBus.containsKey(item.getLineId())){
item.setBusId(mapBus.get(item.getLineId()).getMidBusId());
}
item.setStandShortCapacity(COverlimit.getStandShortCap(map.get(item.getVoltageLevel()).getValue()));
}).collect(Collectors.toList());
page.setRecords(temList);
return page; return page;
} }

View File

@@ -1,5 +1,6 @@
package com.njcn.system.service.impl; package com.njcn.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
@@ -8,6 +9,7 @@ import com.njcn.system.pojo.vo.DictTreeVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -54,24 +56,22 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
@Override @Override
public List<DictTreeVO> queryByPid(String pid) { public List<DictTreeVO> queryByPid(String pid) {
List<DictTreeVO> collect = new ArrayList<>();
LambdaQueryWrapper<SysDicTreePO> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDicTreePO> query = new LambdaQueryWrapper<>();
query.clear();
query.eq(SysDicTreePO::getPid, pid).eq(SysDicTreePO::getStatus,"0"); query.eq(SysDicTreePO::getPid, pid).eq(SysDicTreePO::getStatus,"0");
List<SysDicTreePO> resultList = this.list(query); List<SysDicTreePO> resultList = this.list(query);
SysDicTreePO byId = this.getById(pid); SysDicTreePO byId = this.getById(pid);
if (resultList != null && resultList.size() > 0) { if (CollUtil.isNotEmpty(resultList)) {
List<DictTreeVO> collect = resultList.stream().map(temp -> { collect = resultList.stream().map(temp -> {
DictTreeVO resultVO = new DictTreeVO(); DictTreeVO resultVO = new DictTreeVO();
BeanUtils.copyProperties(temp, resultVO); BeanUtils.copyProperties(temp, resultVO);
resultVO.setPname(byId.getName()); resultVO.setPname(byId.getName());
return resultVO; return resultVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return collect;
} }
return null; return collect;
} }
@Override @Override