|
|
|
|
@@ -17,9 +17,11 @@ import com.njcn.device.pms.pojo.vo.gw.*;
|
|
|
|
|
import com.njcn.device.pms.service.gwPush.MonitorSendService;
|
|
|
|
|
import com.njcn.device.pms.service.majornetwork.*;
|
|
|
|
|
import com.njcn.system.api.DicDataFeignClient;
|
|
|
|
|
import com.njcn.system.enums.DicDataEnum;
|
|
|
|
|
import com.njcn.system.api.DictTreeFeignClient;
|
|
|
|
|
import com.njcn.system.enums.DicDataTypeEnum;
|
|
|
|
|
import com.njcn.system.pojo.po.DictData;
|
|
|
|
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
|
|
|
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
|
|
|
|
import com.njcn.user.api.DeptFeignClient;
|
|
|
|
|
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
|
|
|
|
import com.njcn.web.enums.GWSendEnum;
|
|
|
|
|
@@ -33,7 +35,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
@@ -54,64 +55,85 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
private final DeptFeignClient deptFeignClient;
|
|
|
|
|
private final IPowerClientService powerClientService;
|
|
|
|
|
private final DicDataFeignClient dicDataFeignClient;
|
|
|
|
|
private final DictTreeFeignClient dictTreeFeignClient;
|
|
|
|
|
private final IPowerGenerationUserService iPowerGenerationUserService;
|
|
|
|
|
private final ITractionStationService tractionStationService;
|
|
|
|
|
private final IStatationStatService statationStatService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String sendType(MonitorParam.Info param) {
|
|
|
|
|
DictData data = dicDataFeignClient.getDicDataById(param.getMonitorTag()).getData();
|
|
|
|
|
DicDataEnum enumValue = DicDataEnum.getDicDataEnumValue(data.getCode());
|
|
|
|
|
SysDicTreePO dicTree = dictTreeFeignClient.queryById(param.getObjType()).getData();
|
|
|
|
|
if(ObjectUtil.isNull(dicTree)){
|
|
|
|
|
throw new BusinessException("请检查监测对象类型是否存在");
|
|
|
|
|
}
|
|
|
|
|
List<DictTreeVO> objType = dictTreeFeignClient.query(param.getObjType()).getData();
|
|
|
|
|
List<String> objTypeIds=new ArrayList<>();
|
|
|
|
|
objTypeIds.add(param.getObjType());
|
|
|
|
|
if(CollUtil.isNotEmpty(objType)){
|
|
|
|
|
objTypeIds.addAll(objType.stream().map(DictTreeVO::getId).collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
//获取监测点信息
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.in(StrUtil.isNotBlank(param.getMonitorTag()),Monitor::getMonitorTag, param.getMonitorTag())
|
|
|
|
|
.in(Monitor::getObjType, objTypeIds)
|
|
|
|
|
.in(CollUtil.isNotEmpty(param.getIds()),Monitor::getId, param.getIds())
|
|
|
|
|
);
|
|
|
|
|
List<String> powerIds= monitorList.stream().map(Monitor::getPowerrId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<StatationStat> statationStats = statationStatService.listByIds(powerIds);
|
|
|
|
|
Map<String, StatationStat> powerMap = statationStats.stream().collect(Collectors
|
|
|
|
|
.toMap(StatationStat::getPowerId, Function.identity()));
|
|
|
|
|
for (Monitor monitor : monitorList) {
|
|
|
|
|
if(powerMap.containsKey(monitor.getPowerrId())){
|
|
|
|
|
monitor.setPowerrId(powerMap.get(monitor.getPowerrId()).getMidStationId());
|
|
|
|
|
}else{
|
|
|
|
|
monitor.setPowerrId("");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return monitorType(dicTree, monitorList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String monitorType(SysDicTreePO dicTree, List<Monitor> monitorList) {
|
|
|
|
|
String msg;
|
|
|
|
|
switch (enumValue) {
|
|
|
|
|
case WIND_FARM:
|
|
|
|
|
List<WindSourceDto> info = this.windSend(param.getIds(), Arrays.asList(data.getId()));
|
|
|
|
|
if (info.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
switch (dicTree.getCode()) {
|
|
|
|
|
case "1401":
|
|
|
|
|
List<WindSourceDto> info = this.windSend(monitorList);
|
|
|
|
|
sendSize(info);
|
|
|
|
|
SendParam sendParam = new SendParam();
|
|
|
|
|
sendParam.setStats(info);
|
|
|
|
|
Map<String, String> send = GwSendUtil.send(sendParam, GWSendEnum.WIND_CREATE);
|
|
|
|
|
List<String> wiIds = info.stream().map(WindSourceDto::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
msg = returnInformation(1, wiIds, send);
|
|
|
|
|
break;
|
|
|
|
|
case POWER_STATION:
|
|
|
|
|
List<PhotovoltaicDto> photovoltaic = this.photovoltaicSend(param.getIds(), Arrays.asList(data.getId()));
|
|
|
|
|
if (photovoltaic.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
case "1402":
|
|
|
|
|
List<PhotovoltaicDto> photovoltaic = this.photovoltaicSend(monitorList);
|
|
|
|
|
sendSize(photovoltaic);
|
|
|
|
|
SendParam phSend = new SendParam();
|
|
|
|
|
phSend.setStats(photovoltaic);
|
|
|
|
|
Map<String, String> phMap = GwSendUtil.send(phSend, GWSendEnum.PHOTOVOLTAIC_CREATE);
|
|
|
|
|
List<String> phIds = photovoltaic.stream().map(PhotovoltaicDto::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
msg = returnInformation(1, phIds, phMap);
|
|
|
|
|
break;
|
|
|
|
|
case SENSITIVE_USERS:
|
|
|
|
|
List<SensitiveUserDto> sensitive = this.sensitiveUserSend(param.getIds(), Arrays.asList(data.getId()));
|
|
|
|
|
if (sensitive.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
case "2400":
|
|
|
|
|
List<SensitiveUserDto> sensitive = this.sensitiveUserSend(monitorList);
|
|
|
|
|
sendSize(sensitive);
|
|
|
|
|
SendParam seSend = new SendParam();
|
|
|
|
|
seSend.setStats(sensitive);
|
|
|
|
|
Map<String, String> seMap = GwSendUtil.send(seSend, GWSendEnum.SENSITIVE_USER_CREATE);
|
|
|
|
|
List<String> seIds = sensitive.stream().map(SensitiveUserDto::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
msg = returnInformation(1, seIds, seMap);
|
|
|
|
|
break;
|
|
|
|
|
case ELECTRIFIED_RAILWAYS:
|
|
|
|
|
List<TractionStationDTO> traction = this.tractionStationSend(param.getIds(), Arrays.asList(data.getId()));
|
|
|
|
|
if (traction.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
case "1300":
|
|
|
|
|
List<TractionStationDTO> traction = this.tractionStationSend(monitorList);
|
|
|
|
|
sendSize(traction);
|
|
|
|
|
SendParam trSend = new SendParam();
|
|
|
|
|
trSend.setStats(traction);
|
|
|
|
|
Map<String, String> trMap = GwSendUtil.send(trSend, GWSendEnum.TRACTION_STATION);
|
|
|
|
|
List<String> trIds = traction.stream().map(TractionStationDTO::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
msg = returnInformation(1, trIds, trMap);
|
|
|
|
|
break;
|
|
|
|
|
case LINEAR_LOADS:
|
|
|
|
|
List<OtherUserDto> other = this.otherUserSend(param.getIds(), Arrays.asList(data.getId()));
|
|
|
|
|
if (other.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
case "2300":
|
|
|
|
|
List<OtherUserDto> other = this.otherUserSend(monitorList);
|
|
|
|
|
sendSize(other);
|
|
|
|
|
SendParam otSend = new SendParam();
|
|
|
|
|
otSend.setStats(other);
|
|
|
|
|
Map<String, String> otMap = GwSendUtil.send(otSend, GWSendEnum.OTHER_USER_CREATE);
|
|
|
|
|
@@ -124,17 +146,18 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void sendSize(List info) {
|
|
|
|
|
if (CollUtil.isEmpty(info)) {
|
|
|
|
|
throw new BusinessException("查询数据为空,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
if (info.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public List<WindSourceDto> windSend(List<String> ids,List<String> id) {
|
|
|
|
|
//获取监测点信息
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
public List<WindSourceDto> windSend(List<Monitor> monitorList) {
|
|
|
|
|
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
|
|
|
|
Map<String, PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
|
|
|
|
|
Map<String, PvTerminalTreeVO> mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity()));
|
|
|
|
|
@@ -152,7 +175,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
sendVO = new WindSourceDto();
|
|
|
|
|
//添加部门信息
|
|
|
|
|
BeanUtil.copyProperties(setOrgProvince(mapCode, mapList, monitor.getOrgId()), sendVO);
|
|
|
|
|
sendVO.setStationName(monitor.getName());
|
|
|
|
|
sendVO.setStationName(monitor.getMonitorObjectName());
|
|
|
|
|
//电站等级
|
|
|
|
|
if (mapVoltage.containsKey(monitor.getVoltageLevel())) {
|
|
|
|
|
sendVO.setGcVoltageLevel(String.format("%02d", mapVoltage.get(monitor.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
@@ -160,10 +183,10 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
}
|
|
|
|
|
sendVO.setId(monitor.getId());
|
|
|
|
|
sendVO.setIsSpecial(monitor.getIsSpecialSupplyElectricity().toString());
|
|
|
|
|
// sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
sendVO.setMonitorId(monitor.getMonitorId());
|
|
|
|
|
sendVO.setStationCapacity(monitor.getUserAgreementCapacity());
|
|
|
|
|
sendVO.setStationId(monitor.getId());
|
|
|
|
|
// sendVO.setSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setSubstationName(monitor.getPowerrName());
|
|
|
|
|
sendVO.setFcId(monitor.getMonitorObjectId());
|
|
|
|
|
sendVO.setFcNo(monitor.getMonitorObjectId());
|
|
|
|
|
@@ -193,15 +216,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public List<PhotovoltaicDto> photovoltaicSend(List<String> ids,List<String> id) {
|
|
|
|
|
//获取监测点信息
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
throw new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
public List<PhotovoltaicDto> photovoltaicSend(List<Monitor> monitorList) {
|
|
|
|
|
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
|
|
|
|
Map<String, PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
|
|
|
|
|
Map<String, PvTerminalTreeVO> mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity()));
|
|
|
|
|
@@ -219,7 +234,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
sendVO = new PhotovoltaicDto();
|
|
|
|
|
//添加部门信息
|
|
|
|
|
BeanUtil.copyProperties(setOrgProvince(mapCode, mapList, monitor.getOrgId()), sendVO);
|
|
|
|
|
sendVO.setStationName(monitor.getName());
|
|
|
|
|
sendVO.setStationName(monitor.getMonitorObjectName());
|
|
|
|
|
//电站等级
|
|
|
|
|
if (mapVoltage.containsKey(monitor.getVoltageLevel())) {
|
|
|
|
|
sendVO.setGcVoltageLevel(String.format("%02d", mapVoltage.get(monitor.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
@@ -227,10 +242,10 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
}
|
|
|
|
|
sendVO.setId(monitor.getId());
|
|
|
|
|
sendVO.setIsSpecial(monitor.getIsSpecialSupplyElectricity().toString());
|
|
|
|
|
// sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
sendVO.setMonitorId(monitor.getMonitorId());
|
|
|
|
|
sendVO.setStationCapacity(monitor.getUserAgreementCapacity());
|
|
|
|
|
sendVO.setStationId(monitor.getId());
|
|
|
|
|
// sendVO.setSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setSubstationName(monitor.getPowerrName());
|
|
|
|
|
sendVO.setFcId(monitor.getMonitorObjectId());
|
|
|
|
|
sendVO.setFcNo(monitor.getMonitorObjectId());
|
|
|
|
|
@@ -258,14 +273,8 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public List<SensitiveUserDto> sensitiveUserSend(List<String> ids,List<String> id) {
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
throw new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
public List<SensitiveUserDto> sensitiveUserSend(List<Monitor> monitorList) {
|
|
|
|
|
|
|
|
|
|
//根据用户类型进行分组
|
|
|
|
|
Map<Integer, List<String>> userMonitor = monitorList.stream().filter(x -> ObjectUtil.isNotNull(x.getIfPowerUser()))
|
|
|
|
|
.collect(Collectors.groupingBy(Monitor::getIfPowerUser,
|
|
|
|
|
@@ -324,8 +333,8 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
}
|
|
|
|
|
sendVO.setSensitiveUserName(monitor.getName());
|
|
|
|
|
sendVO.setUserProtocolCapacity(monitor.getUserAgreementCapacity());
|
|
|
|
|
// sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
// sendVO.setStationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setMonitorId(monitor.getMonitorId());
|
|
|
|
|
sendVO.setStationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setStationName(monitor.getPowerrName());
|
|
|
|
|
sendVO.setPubPrivFlag(monitor.getIsSpecialMonitor() + "");
|
|
|
|
|
//运行状态
|
|
|
|
|
@@ -384,15 +393,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public List<TractionStationDTO> tractionStationSend(List<String> ids,List<String> id) {
|
|
|
|
|
//获取牵引站信息
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
throw new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
public List<TractionStationDTO> tractionStationSend(List<Monitor> monitorList) {
|
|
|
|
|
//获取已存在牵引站的信息
|
|
|
|
|
List<String> tractionIds = monitorList.stream().map(Monitor::getTractionId).collect(Collectors.toList());
|
|
|
|
|
List<TractionStation> tractionStationList = tractionStationService.list(new LambdaQueryWrapper<TractionStation>()
|
|
|
|
|
@@ -428,15 +429,15 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
sendVO.setConnetGroupWay(dictData.getValue());
|
|
|
|
|
}
|
|
|
|
|
sendVO.setIfSpecial(traction.getIfSpecial() + "");
|
|
|
|
|
sendVO.setRailwayId(traction.getRailwayLineId());
|
|
|
|
|
sendVO.setRailwayNumber(traction.getRailwayLineId());
|
|
|
|
|
sendVO.setRailwayName(traction.getName());
|
|
|
|
|
|
|
|
|
|
sendVO.setRailwayName(traction.getRailwayLineName());
|
|
|
|
|
sendVO.setRailwayType(traction.getRailwayType());
|
|
|
|
|
sendVO.setTractionCode(traction.getId());
|
|
|
|
|
sendVO.setTractionSubstationCapacity(traction.getRatedCapacity());
|
|
|
|
|
// sendVO.setTractionSubstationId(traction.getPowerId());
|
|
|
|
|
sendVO.setTractionSubstationName(traction.getPowerName());
|
|
|
|
|
// sendVO.setMainSubstationId(traction.getPowerId());
|
|
|
|
|
sendVO.setMainSubstationName(traction.getPowerName());
|
|
|
|
|
sendVO.setTractionSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setTractionSubstationName(monitor.getPowerrName());
|
|
|
|
|
sendVO.setMainSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setMainSubstationName(monitor.getPowerrName());
|
|
|
|
|
//电压等级
|
|
|
|
|
if (mapVoltage.containsKey(traction.getVoltageLevel())) {
|
|
|
|
|
sendVO.setTractionVoltageLevel(String.format("%02d", mapVoltage.get(traction.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
@@ -447,15 +448,15 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
sendVO.setTractionVoltageLevel(String.format("%02d", mapVoltage.get(monitor.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
sendVO.setMainVolatageLevel(String.format("%02d", mapVoltage.get(monitor.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
}
|
|
|
|
|
// sendVO.setTractionSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setTractionSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setTractionSubstationName(monitor.getPowerrName());
|
|
|
|
|
// sendVO.setMainSubstationId(monitor.getPowerId());
|
|
|
|
|
sendVO.setMainSubstationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setMainSubstationName(monitor.getPowerrName());
|
|
|
|
|
}
|
|
|
|
|
sendVO.setCreateTime(monitor.getCreateTime());
|
|
|
|
|
sendVO.setUpdateTime(monitor.getUpdateTime());
|
|
|
|
|
sendVO.setId(monitor.getId());
|
|
|
|
|
// sendVO.setMonitorNumber(monitor);
|
|
|
|
|
sendVO.setMonitorNumber(monitor.getMonitorId());
|
|
|
|
|
|
|
|
|
|
//运行状态
|
|
|
|
|
if (mapLineState.containsKey(monitor.getMonitorState())) {
|
|
|
|
|
@@ -485,14 +486,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<OtherUserDto> otherUserSend(List<String> ids,List<String> id) {
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
throw new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
public List<OtherUserDto> otherUserSend(List<Monitor> monitorList) {
|
|
|
|
|
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
|
|
|
|
Map<String, PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
|
|
|
|
|
Map<String, PvTerminalTreeVO> mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity()));
|
|
|
|
|
@@ -524,14 +518,14 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
dto.setGcVoltageLevel(String.format("%02d", mapVoltage.get(monitor.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
dto.setSubstationVoltageLevel(String.format("%02d", mapVoltage.get(monitor.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
}
|
|
|
|
|
// dto.setSubstationId(monitor.getPowerrId());
|
|
|
|
|
dto.setSubstationId(monitor.getPowerrId());
|
|
|
|
|
dto.setSubstationName(monitor.getPowerrName());
|
|
|
|
|
//行业分类
|
|
|
|
|
if (mapIndustryType.containsKey(monitor.getTradeCode())) {
|
|
|
|
|
dto.setTradeCode(mapIndustryType.get(monitor.getTradeCode()).getValue());
|
|
|
|
|
}
|
|
|
|
|
dto.setProtocolCapacity(monitor.getUserAgreementCapacity());
|
|
|
|
|
// dto.setMonitorId(monitor.getId());
|
|
|
|
|
dto.setMonitorId(monitor.getMonitorId());
|
|
|
|
|
// dto.setIsMonitoringOnline();
|
|
|
|
|
// dto.setIsSceneTest();
|
|
|
|
|
// dto.setHaveDevice();
|
|
|
|
|
@@ -554,28 +548,53 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
public void exportSend(HttpServletResponse response) throws IOException {
|
|
|
|
|
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), WindSourceDto.class).build();
|
|
|
|
|
|
|
|
|
|
List<WindSourceDto> wind = this.windSend(new ArrayList<>(), Arrays.asList("1adebade8821a18e4dbb5039fdf00326"));
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet(0, "风电厂" ).head(WindSourceDto.class).build();
|
|
|
|
|
List<WindSourceDto> wind = this.windSend(getMonitors("f3daf821a351da6db44cdc952f90a5cb"));
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet(0, "风电场" ).head(WindSourceDto.class).build();
|
|
|
|
|
excelWriter.write(wind, writeSheet);
|
|
|
|
|
|
|
|
|
|
List<PhotovoltaicDto> photovoltaic = this.photovoltaicSend(new ArrayList<>(), Arrays.asList("c5af15b871a5dd880dace02b8f669e2f"));
|
|
|
|
|
List<PhotovoltaicDto> photovoltaic = this.photovoltaicSend(getMonitors("189b8db113a79738e07946b6ec2bb0da"));
|
|
|
|
|
WriteSheet writeSheet2 = EasyExcel.writerSheet(1, "光伏电站" ).head(PhotovoltaicDto.class).build();
|
|
|
|
|
excelWriter.write(photovoltaic, writeSheet2);
|
|
|
|
|
|
|
|
|
|
List<SensitiveUserDto> sensitive = this.sensitiveUserSend(new ArrayList<>(), Arrays.asList("4e9559adbe3fd935fb6ea43e79b704c0"));
|
|
|
|
|
WriteSheet writeSheet3 = EasyExcel.writerSheet(2, "重或敏感用户" ).head(SensitiveUserDto.class).build();
|
|
|
|
|
List<SensitiveUserDto> sensitive = this.sensitiveUserSend(getMonitors("f7ec8d78654629ae76203bf74041db18"));
|
|
|
|
|
WriteSheet writeSheet3 = EasyExcel.writerSheet(2, "重要或敏感用户" ).head(SensitiveUserDto.class).build();
|
|
|
|
|
excelWriter.write(sensitive, writeSheet3);
|
|
|
|
|
|
|
|
|
|
List<TractionStationDTO> traction = this.tractionStationSend(new ArrayList<>(), Arrays.asList("2990ed905876f2964393ca64f9bd8d40"));
|
|
|
|
|
List<TractionStationDTO> traction = this.tractionStationSend(getMonitors("88401081d00e17f1cd926ef5e57fecf9"));
|
|
|
|
|
WriteSheet writeSheet4 = EasyExcel.writerSheet(3, "牵引站" ).head(TractionStationDTO.class).build();
|
|
|
|
|
excelWriter.write(traction, writeSheet4);
|
|
|
|
|
|
|
|
|
|
List<OtherUserDto> other = this.otherUserSend(new ArrayList<>(), Arrays.asList("08a039a9e3fd4e5038435dfbaa88a8e3"));
|
|
|
|
|
List<OtherUserDto> other = this.otherUserSend(getMonitors("c22758666cd968b756db67dbfad9be32"));
|
|
|
|
|
WriteSheet writeSheet5 = EasyExcel.writerSheet(4, "干扰用户" ).head(OtherUserDto.class).build();
|
|
|
|
|
excelWriter.write(other, writeSheet5);
|
|
|
|
|
excelWriter.finish();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<Monitor> getMonitors(String id) {
|
|
|
|
|
List<DictTreeVO> objType = dictTreeFeignClient.query(id).getData();
|
|
|
|
|
List<String> objTypeIds=new ArrayList<>();
|
|
|
|
|
objTypeIds.add(id);
|
|
|
|
|
if(CollUtil.isNotEmpty(objType)){
|
|
|
|
|
objTypeIds.addAll(objType.stream().map(DictTreeVO::getId).collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
//获取监测点信息
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.in(Monitor::getObjType, objTypeIds)
|
|
|
|
|
);
|
|
|
|
|
List<String> powerIds= monitorList.stream().map(Monitor::getPowerrId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<StatationStat> statationStats = statationStatService.listByIds(powerIds);
|
|
|
|
|
Map<String, StatationStat> powerMap = statationStats.stream().collect(Collectors
|
|
|
|
|
.toMap(StatationStat::getPowerId, Function.identity()));
|
|
|
|
|
for (Monitor monitor : monitorList) {
|
|
|
|
|
if(powerMap.containsKey(monitor.getPowerrId())){
|
|
|
|
|
monitor.setPowerrId(powerMap.get(monitor.getPowerrId()).getMidStationId());
|
|
|
|
|
}else{
|
|
|
|
|
monitor.setPowerrId("");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return monitorList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 省市县,对象添加
|
|
|
|
|
*
|
|
|
|
|
|