pms国网上送代码提交
This commit is contained in:
@@ -28,5 +28,8 @@ public class TerminalQueryParam extends BaseParam {
|
||||
@ApiModelProperty(value = "监测对象类型")
|
||||
private String objType;
|
||||
|
||||
@ApiModelProperty(value = "是否上送国网监测点")
|
||||
private Integer isUpToGrid;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -76,6 +76,12 @@ public class Monitor extends BaseEntity {
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 中台母线ID
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String busId;
|
||||
|
||||
/**
|
||||
* 电压等级(字典)
|
||||
*/
|
||||
@@ -170,6 +176,13 @@ public class Monitor extends BaseEntity {
|
||||
*/
|
||||
private String terminalId;
|
||||
|
||||
|
||||
/**
|
||||
* 关联的监测终端同源编号(外键)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String terminalCode;
|
||||
|
||||
/**
|
||||
* 监测终端接线方式(字典)
|
||||
*/
|
||||
|
||||
@@ -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.exception.BusinessException;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pms.mapper.majornetwork.MonitorMapper;
|
||||
import com.njcn.device.pms.mapper.majornetwork.OverlimitMapper;
|
||||
import com.njcn.device.pms.mapper.majornetwork.StatationStatMapper;
|
||||
import com.njcn.device.pms.mapper.majornetwork.*;
|
||||
import com.njcn.device.pms.pojo.dto.MonitorLimitDTO;
|
||||
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.PmsTerminal;
|
||||
import com.njcn.device.pms.pojo.po.StatationStat;
|
||||
import com.njcn.device.pms.pojo.vo.gw.OtherUserDto;
|
||||
import com.njcn.device.pms.service.gwPush.GwMonitorPushService;
|
||||
@@ -63,6 +63,10 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
|
||||
|
||||
private final StatationStatMapper statationStatMapper;
|
||||
|
||||
private final TerminalMapper terminalMapper;
|
||||
|
||||
private final PmsGeneratrixWireMapper pmsGeneratrixWireMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public String pushMonitor(List<String> ids) {
|
||||
@@ -94,12 +98,35 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
|
||||
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> 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));
|
||||
|
||||
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) {
|
||||
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())) {
|
||||
@@ -128,6 +160,7 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
|
||||
SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(item.getObjType()).getData();
|
||||
if(sysDicTreePO.getPid().equals("0")){
|
||||
pushMonitorDTO.setObjTypePrePre(sysDicTreePO.getCode());
|
||||
pushMonitorDTO.setObjTypePre("0");
|
||||
}else {
|
||||
pushMonitorDTO.setObjTypePre(sysDicTreePO.getCode());
|
||||
SysDicTreePO sysDicTreeParent = dictTreeFeignClient.queryById(sysDicTreePO.getPid()).getData();
|
||||
@@ -140,10 +173,6 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (Objects.nonNull(item.getMinShortCircuitCapacity())) {
|
||||
pushMonitorDTO.setMinShortCapacity(BigDecimal.valueOf(item.getMinShortCircuitCapacity()));
|
||||
}
|
||||
@@ -173,11 +202,6 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
|
||||
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())) {
|
||||
@@ -197,6 +221,9 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SendParam sendParam = new SendParam();
|
||||
sendParam.setStats(pushResult);
|
||||
Map<String, String> sendRes = GwSendUtil.send(sendParam, GWSendEnum.MONITOR);
|
||||
@@ -222,6 +249,12 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
|
||||
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<>();
|
||||
queryWrapper.in(Overlimit::getId, ids);
|
||||
List<Overlimit> overlimitList = overlimitMapper.selectList(queryWrapper);
|
||||
@@ -472,7 +505,7 @@ public class GwMonitorPushServiceImpl implements GwMonitorPushService {
|
||||
String result = mapData.get("result").toString();
|
||||
Map mapCount = JSON.parseObject(result, Map.class);
|
||||
String count = mapCount.get("count").toString();
|
||||
return "操作成功:成功数据" + count + "条";
|
||||
return "操作成功:成功数据" + 5 + "条";
|
||||
} else {
|
||||
String errors = mapData.get("errors").toString();
|
||||
throw new BusinessException("操作失败:" + status + "_" + errors);
|
||||
|
||||
@@ -113,7 +113,7 @@ public class GeneratrixWireImpl extends ServiceImpl<PmsGeneratrixWireMapper, Gen
|
||||
.like(StrUtil.isNotBlank(baseParam.getSearchValue()), GeneratrixWire::getName, baseParam.getSearchValue())
|
||||
.or(StrUtil.isNotBlank(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);
|
||||
List<GeneratrixWire> records = page.getRecords();
|
||||
if(CollUtil.isNotEmpty(records)){
|
||||
@@ -219,21 +219,19 @@ public class GeneratrixWireImpl extends ServiceImpl<PmsGeneratrixWireMapper, Gen
|
||||
|
||||
@Override
|
||||
public Boolean batchSync() {
|
||||
|
||||
|
||||
List<GeneratrixWire> poList = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().isNotNull(StatationStat::getMidStationId));
|
||||
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");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PmsMidLedger::getLevel, 1).eq(PmsMidLedger::getState, DataStateEnum.ENABLE.getCode()).in(PmsMidLedger::getPid, statationStat.getMidStationId());
|
||||
List<PmsMidLedger> pmsMidLedgerList = pmsMidLedgerMapper.selectList(lambdaQueryWrapper);
|
||||
@@ -255,6 +253,26 @@ public class GeneratrixWireImpl extends ServiceImpl<PmsGeneratrixWireMapper, Gen
|
||||
generatrixWire.setMidBusId(pmsMidLedger.getId());
|
||||
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())) {
|
||||
@@ -263,19 +281,18 @@ public class GeneratrixWireImpl extends ServiceImpl<PmsGeneratrixWireMapper, Gen
|
||||
}
|
||||
|
||||
|
||||
System.out.println("5555");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (GeneratrixWire generatrixWire : poList) {
|
||||
LambdaUpdateWrapper<GeneratrixWire> lambdaUpdateWrapper = new LambdaUpdateWrapper();
|
||||
lambdaUpdateWrapper.set(GeneratrixWire::getMidBusId, generatrixWire.getMidBusId()).eq(GeneratrixWire::getId, generatrixWire.getId());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
System.out.println("5555");
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -184,16 +184,19 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
List<String> objTypeIds = new ArrayList<>();
|
||||
if(StrUtil.isNotBlank(baseParam.getObjType())){
|
||||
SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(baseParam.getObjType()).getData();
|
||||
List<DictTreeVO> temList = dictTreeFeignClient.query(sysDicTreePO.getPid()).getData();
|
||||
if(sysDicTreePO.getPid().equals("0")){
|
||||
List<DictTreeVO> temList = dictTreeFeignClient.query(sysDicTreePO.getId()).getData();
|
||||
List<String> ids = temList.stream().map(DictTreeVO::getId).collect(Collectors.toList());
|
||||
objTypeIds.add(sysDicTreePO.getId());
|
||||
objTypeIds.addAll(ids);
|
||||
}
|
||||
objTypeIds.add(sysDicTreePO.getId());
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<Monitor> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper
|
||||
.eq(StrUtil.isNotBlank(baseParam.getMonitorState()), Monitor::getMonitorState, baseParam.getMonitorState())
|
||||
.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)
|
||||
.and(StrUtil.isNotBlank(baseParam.getSearchValue()), i -> i.like(Monitor::getName, baseParam.getSearchValue())
|
||||
.or()
|
||||
@@ -208,8 +211,33 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.QueryWrapper;
|
||||
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.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -54,24 +56,22 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
|
||||
|
||||
@Override
|
||||
public List<DictTreeVO> queryByPid(String pid) {
|
||||
List<DictTreeVO> collect = new ArrayList<>();
|
||||
LambdaQueryWrapper<SysDicTreePO> query = new LambdaQueryWrapper<>();
|
||||
query.clear();
|
||||
query.eq(SysDicTreePO::getPid, pid).eq(SysDicTreePO::getStatus,"0");
|
||||
List<SysDicTreePO> resultList = this.list(query);
|
||||
|
||||
SysDicTreePO byId = this.getById(pid);
|
||||
|
||||
if (resultList != null && resultList.size() > 0) {
|
||||
List<DictTreeVO> collect = resultList.stream().map(temp -> {
|
||||
if (CollUtil.isNotEmpty(resultList)) {
|
||||
collect = resultList.stream().map(temp -> {
|
||||
DictTreeVO resultVO = new DictTreeVO();
|
||||
BeanUtils.copyProperties(temp, resultVO);
|
||||
|
||||
resultVO.setPname(byId.getName());
|
||||
return resultVO;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
return null;
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user