|
|
|
|
@@ -4,6 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
|
import com.alibaba.excel.ExcelWriter;
|
|
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
@@ -27,7 +30,10 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
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;
|
|
|
|
|
@@ -56,38 +62,82 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
DictData data = dicDataFeignClient.getDicDataById(param.getMonitorTag()).getData();
|
|
|
|
|
DicDataEnum enumValue = DicDataEnum.getDicDataEnumValue(data.getCode());
|
|
|
|
|
String msg;
|
|
|
|
|
switch (enumValue){
|
|
|
|
|
switch (enumValue) {
|
|
|
|
|
case WIND_FARM:
|
|
|
|
|
msg=this.windSend(param.getIds());
|
|
|
|
|
List<WindSourceDto> info = this.windSend(param.getIds(), Arrays.asList(data.getId()));
|
|
|
|
|
if (info.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
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:
|
|
|
|
|
msg= this.photovoltaicSend(param.getIds());
|
|
|
|
|
List<PhotovoltaicDto> photovoltaic = this.photovoltaicSend(param.getIds(), Arrays.asList(data.getId()));
|
|
|
|
|
if (photovoltaic.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
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:
|
|
|
|
|
msg= this.sensitiveUserSend(param.getIds());
|
|
|
|
|
List<SensitiveUserDto> sensitive = this.sensitiveUserSend(param.getIds(), Arrays.asList(data.getId()));
|
|
|
|
|
if (sensitive.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
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条数据");
|
|
|
|
|
}
|
|
|
|
|
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条数据");
|
|
|
|
|
}
|
|
|
|
|
SendParam otSend = new SendParam();
|
|
|
|
|
otSend.setStats(other);
|
|
|
|
|
Map<String, String> otMap = GwSendUtil.send(otSend, GWSendEnum.OTHER_USER_CREATE);
|
|
|
|
|
List<String> otIds = other.stream().map(OtherUserDto::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
msg = returnInformation(1, otIds, otMap);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
throw new BusinessException("请选择国网上送的监测点对象标签上送!");
|
|
|
|
|
throw new BusinessException("请选择国网上送的监测点标签上送");
|
|
|
|
|
}
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public String windSend(List<String> ids) {
|
|
|
|
|
public List<WindSourceDto> windSend(List<String> ids,List<String> id) {
|
|
|
|
|
//获取监测点信息
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.in(Monitor::getId, ids)
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
return "为查询数据,请查询数据是否存在!";
|
|
|
|
|
new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
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()));
|
|
|
|
|
//治理装置类型
|
|
|
|
|
List<DictData> deviceType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapDeviceType = deviceType.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
//电压等级
|
|
|
|
|
List<DictData> voltage = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapVoltage = voltage.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
@@ -110,10 +160,10 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
}
|
|
|
|
|
sendVO.setId(monitor.getId());
|
|
|
|
|
sendVO.setIsSpecial(monitor.getIsSpecialSupplyElectricity().toString());
|
|
|
|
|
sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
// sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
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());
|
|
|
|
|
@@ -136,35 +186,25 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
// sendVO.setWindNum();
|
|
|
|
|
// sendVO.setWindStationType();
|
|
|
|
|
// sendVO.setWindType();
|
|
|
|
|
//
|
|
|
|
|
info.add(sendVO);
|
|
|
|
|
}
|
|
|
|
|
if (info.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
SendParam param = new SendParam();
|
|
|
|
|
param.setStats(info);
|
|
|
|
|
Map<String, String> send = GwSendUtil.send(param, GWSendEnum.WIND_CREATE);
|
|
|
|
|
List<String> trIds = info.stream().map(WindSourceDto::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
return returnInformation(1, trIds, send);
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public String photovoltaicSend(List<String> ids) {
|
|
|
|
|
public List<PhotovoltaicDto> photovoltaicSend(List<String> ids,List<String> id) {
|
|
|
|
|
//获取监测点信息
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.in(Monitor::getId, ids)
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
return "为查询数据,请查询数据是否存在!";
|
|
|
|
|
throw new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
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()));
|
|
|
|
|
//治理装置类型
|
|
|
|
|
List<DictData> deviceType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapDeviceType = deviceType.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
//电压等级
|
|
|
|
|
List<DictData> voltage = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapVoltage = voltage.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
@@ -187,10 +227,10 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
}
|
|
|
|
|
sendVO.setId(monitor.getId());
|
|
|
|
|
sendVO.setIsSpecial(monitor.getIsSpecialSupplyElectricity().toString());
|
|
|
|
|
sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
// sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
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());
|
|
|
|
|
@@ -213,22 +253,19 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
|
|
|
|
|
info.add(sendVO);
|
|
|
|
|
}
|
|
|
|
|
if (info.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
SendParam param = new SendParam();
|
|
|
|
|
param.setStats(info);
|
|
|
|
|
Map<String, String> send = GwSendUtil.send(param, GWSendEnum.PHOTOVOLTAIC_CREATE);
|
|
|
|
|
List<String> trIds = info.stream().map(PhotovoltaicDto::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
return returnInformation(1, trIds, send);
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public String sensitiveUserSend(List<String> ids) {
|
|
|
|
|
public List<SensitiveUserDto> sensitiveUserSend(List<String> ids,List<String> id) {
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.in(Monitor::getId, ids)
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
throw new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
//根据用户类型进行分组
|
|
|
|
|
Map<Integer, List<String>> userMonitor = monitorList.stream().filter(x -> ObjectUtil.isNotNull(x.getIfPowerUser()))
|
|
|
|
|
.collect(Collectors.groupingBy(Monitor::getIfPowerUser,
|
|
|
|
|
@@ -240,14 +277,11 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
.in(PowerClient::getId, userMonitor.get(0)));
|
|
|
|
|
}
|
|
|
|
|
//获取发电用户
|
|
|
|
|
List<PowerGenerationUser> powerGenerationUsers =new ArrayList<>();
|
|
|
|
|
if(userMonitor.containsKey(1)){
|
|
|
|
|
List<PowerGenerationUser> powerGenerationUsers = new ArrayList<>();
|
|
|
|
|
if (userMonitor.containsKey(1)) {
|
|
|
|
|
powerGenerationUsers = iPowerGenerationUserService.list(new LambdaQueryWrapper<PowerGenerationUser>()
|
|
|
|
|
.in(PowerGenerationUser::getId, userMonitor.get(1)));
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
return "为查询数据,请查询数据是否存在!";
|
|
|
|
|
}
|
|
|
|
|
//用户分类
|
|
|
|
|
List<DictData> userClass = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.USER_CLASS.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapUserClass = userClass.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
@@ -281,19 +315,19 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
PvTerminalTreeVO pvTerminalTreeVO;
|
|
|
|
|
//添加部门信息
|
|
|
|
|
BeanUtil.copyProperties(setOrgProvince(mapCode, mapList, monitor.getOrgId()), sendVO);
|
|
|
|
|
|
|
|
|
|
sendVO.setId(monitor.getId());
|
|
|
|
|
if (mapList.containsKey(monitor.getOperationId())) {
|
|
|
|
|
pvTerminalTreeVO = mapList.get(monitor.getOperationId());
|
|
|
|
|
|
|
|
|
|
if (mapCode.containsKey(monitor.getOperationId())) {
|
|
|
|
|
pvTerminalTreeVO = mapCode.get(monitor.getOperationId());
|
|
|
|
|
sendVO.setMaintGroupName(pvTerminalTreeVO.getName());
|
|
|
|
|
sendVO.setMaintGroupId(pvTerminalTreeVO.getCode());
|
|
|
|
|
}
|
|
|
|
|
sendVO.setSensitiveUserName(monitor.getName());
|
|
|
|
|
sendVO.setUserProtocolCapacity(monitor.getUserAgreementCapacity());
|
|
|
|
|
sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
sendVO.setStationId(monitor.getPowerrId());
|
|
|
|
|
// sendVO.setMonitorId(monitor.getId());
|
|
|
|
|
// sendVO.setStationId(monitor.getPowerrId());
|
|
|
|
|
sendVO.setStationName(monitor.getPowerrName());
|
|
|
|
|
sendVO.setPubPrivFlag(monitor.getIsSpecialMonitor()+"");
|
|
|
|
|
sendVO.setPubPrivFlag(monitor.getIsSpecialMonitor() + "");
|
|
|
|
|
//运行状态
|
|
|
|
|
if (mapLineState.containsKey(monitor.getMonitorState())) {
|
|
|
|
|
sendVO.setRunStatus(mapLineState.get(monitor.getMonitorState()).getValue());
|
|
|
|
|
@@ -302,15 +336,20 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
sendVO.setUpdateTime(monitor.getUpdateTime());
|
|
|
|
|
if (mapVoltage.containsKey(monitor.getVoltageLevel())) {
|
|
|
|
|
sendVO.setStationVoltageLevel(String.format("%02d", mapVoltage.get(monitor.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
sendVO.setConsVoltageLevel(String.format("%02d", mapVoltage.get(monitor.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
}
|
|
|
|
|
//行业分类
|
|
|
|
|
if (mapIndustryType.containsKey(monitor.getTradeCode())) {
|
|
|
|
|
DictData dictData = mapIndustryType.get(monitor.getTradeCode());
|
|
|
|
|
sendVO.setTradeCode(dictData.getValue());
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isNotNull(monitor.getIfPowerUser())) {
|
|
|
|
|
setSensitiveUser(powerClients,powerGenerationUsers,mapVoltage, mapUserClass, mapEleClass, mapIndustryType, mapImportanceLevel, sendVO, monitor);
|
|
|
|
|
setSensitiveUser(powerClients, powerGenerationUsers, mapVoltage, mapUserClass, mapEleClass, mapImportanceLevel, sendVO, monitor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// sendVO.setMeterAddress();
|
|
|
|
|
// sendVO.setTradeCode();
|
|
|
|
|
// sendVO.setConsVoltageLevel();
|
|
|
|
|
//
|
|
|
|
|
// sendVO.setFeederId();
|
|
|
|
|
// sendVO.setFeederName();
|
|
|
|
|
@@ -339,27 +378,27 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
|
|
|
|
|
info.add(sendVO);
|
|
|
|
|
}
|
|
|
|
|
if (info.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
}
|
|
|
|
|
SendParam param = new SendParam();
|
|
|
|
|
param.setStats(info);
|
|
|
|
|
Map<String, String> send = GwSendUtil.send(param, GWSendEnum.SENSITIVE_USER_CREATE);
|
|
|
|
|
List<String> trIds = info.stream().map(SensitiveUserDto::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
return returnInformation(1, trIds, send);
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public String tractionStationSend(List<String> ids) {
|
|
|
|
|
public List<TractionStationDTO> tractionStationSend(List<String> ids,List<String> id) {
|
|
|
|
|
//获取牵引站信息
|
|
|
|
|
List<TractionStation> tractionStationList = tractionStationService.list(new LambdaQueryWrapper<TractionStation>()
|
|
|
|
|
.in(TractionStation::getId, ids)
|
|
|
|
|
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>()
|
|
|
|
|
.eq(Monitor::getMonitorTag, id)
|
|
|
|
|
.in(CollUtil.isNotEmpty(ids),Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isEmpty(tractionStationList)) {
|
|
|
|
|
return "为查询数据,请查询数据是否存在!";
|
|
|
|
|
if (CollUtil.isEmpty(monitorList)) {
|
|
|
|
|
throw new BusinessException("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
//获取已存在牵引站的信息
|
|
|
|
|
List<String> tractionIds = monitorList.stream().map(Monitor::getTractionId).collect(Collectors.toList());
|
|
|
|
|
List<TractionStation> tractionStationList = tractionStationService.list(new LambdaQueryWrapper<TractionStation>()
|
|
|
|
|
.in(TractionStation::getId, tractionIds));
|
|
|
|
|
Map<String, TractionStation> tractionMap = tractionStationList.stream().collect(Collectors.toMap(TractionStation::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
List<TractionStationDTO> info = new ArrayList<>();
|
|
|
|
|
TractionStationDTO sendVO;
|
|
|
|
|
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
|
|
|
|
@@ -368,36 +407,61 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
//牵引站变压器接线方式
|
|
|
|
|
List<DictData> connetGroupWay = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.CONNET_GROUP_WAY.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapConnetGroupWay = connetGroupWay.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
//运行状态
|
|
|
|
|
List<DictData> lineState = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapLineState = lineState.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
//电压等级
|
|
|
|
|
List<DictData> voltage = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapVoltage = voltage.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (TractionStation traction : tractionStationList) {
|
|
|
|
|
TractionStation traction;
|
|
|
|
|
for (Monitor monitor : monitorList) {
|
|
|
|
|
sendVO = new TractionStationDTO();
|
|
|
|
|
DictData dictData;
|
|
|
|
|
//添加部门信息
|
|
|
|
|
BeanUtil.copyProperties(setOrgProvince(mapCode, mapList, traction.getOrgId()), sendVO);
|
|
|
|
|
//牵引站变压器接线方式
|
|
|
|
|
if (mapConnetGroupWay.containsKey(traction.getConnetGroupWay())) {
|
|
|
|
|
dictData = mapConnetGroupWay.get(traction.getConnetGroupWay());
|
|
|
|
|
sendVO.setConnetGroupWay(dictData.getValue());
|
|
|
|
|
BeanUtil.copyProperties(setOrgProvince(mapCode, mapList, monitor.getOrgId()), sendVO);
|
|
|
|
|
if(tractionMap.containsKey(monitor.getTractionId())){
|
|
|
|
|
traction = tractionMap.get(monitor.getTractionId());
|
|
|
|
|
//牵引站变压器接线方式
|
|
|
|
|
if (mapConnetGroupWay.containsKey(traction.getConnetGroupWay())) {
|
|
|
|
|
dictData = mapConnetGroupWay.get(traction.getConnetGroupWay());
|
|
|
|
|
sendVO.setConnetGroupWay(dictData.getValue());
|
|
|
|
|
}
|
|
|
|
|
sendVO.setIfSpecial(traction.getIfSpecial() + "");
|
|
|
|
|
sendVO.setRailwayId(traction.getRailwayLineId());
|
|
|
|
|
sendVO.setRailwayNumber(traction.getRailwayLineId());
|
|
|
|
|
sendVO.setRailwayName(traction.getName());
|
|
|
|
|
sendVO.setTractionCode(traction.getId());
|
|
|
|
|
sendVO.setTractionSubstationCapacity(traction.getRatedCapacity());
|
|
|
|
|
// sendVO.setTractionSubstationId(traction.getPowerId());
|
|
|
|
|
sendVO.setTractionSubstationName(traction.getPowerName());
|
|
|
|
|
// sendVO.setMainSubstationId(traction.getPowerId());
|
|
|
|
|
sendVO.setMainSubstationName(traction.getPowerName());
|
|
|
|
|
//电压等级
|
|
|
|
|
if (mapVoltage.containsKey(traction.getVoltageLevel())) {
|
|
|
|
|
sendVO.setTractionVoltageLevel(String.format("%02d", mapVoltage.get(traction.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
sendVO.setMainVolatageLevel(String.format("%02d", mapVoltage.get(traction.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if (mapVoltage.containsKey(monitor.getVoltageLevel())) {
|
|
|
|
|
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.setTractionSubstationName(monitor.getPowerrName());
|
|
|
|
|
// sendVO.setMainSubstationId(monitor.getPowerId());
|
|
|
|
|
sendVO.setMainSubstationName(monitor.getPowerrName());
|
|
|
|
|
}
|
|
|
|
|
sendVO.setCreateTime(traction.getCreateTime());
|
|
|
|
|
sendVO.setIfSpecial(traction.getIfSpecial() + "");
|
|
|
|
|
sendVO.setRailwayId(traction.getRailwayLineId());
|
|
|
|
|
sendVO.setRailwayNumber(traction.getRailwayLineId());
|
|
|
|
|
sendVO.setRailwayName(traction.getName());
|
|
|
|
|
sendVO.setTractionCode(traction.getId());
|
|
|
|
|
sendVO.setTractionSubstationCapacity(traction.getRatedCapacity());
|
|
|
|
|
sendVO.setTractionSubstationId(traction.getPowerId());
|
|
|
|
|
sendVO.setTractionSubstationName(traction.getPowerName());
|
|
|
|
|
//电压等级
|
|
|
|
|
if (mapVoltage.containsKey(traction.getVoltageLevel())) {
|
|
|
|
|
sendVO.setTractionVoltageLevel(String.format("%02d", mapVoltage.get(traction.getVoltageLevel()).getAlgoDescribe()));
|
|
|
|
|
sendVO.setCreateTime(monitor.getCreateTime());
|
|
|
|
|
sendVO.setUpdateTime(monitor.getUpdateTime());
|
|
|
|
|
sendVO.setId(monitor.getId());
|
|
|
|
|
// sendVO.setMonitorNumber(monitor);
|
|
|
|
|
|
|
|
|
|
//运行状态
|
|
|
|
|
if (mapLineState.containsKey(monitor.getMonitorState())) {
|
|
|
|
|
sendVO.setRunStatus(mapLineState.get(monitor.getMonitorState()).getValue());
|
|
|
|
|
}
|
|
|
|
|
sendVO.setUpdateTime(traction.getUpdateTime());
|
|
|
|
|
sendVO.setId(traction.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// sendVO.setAuxiliarySubstationId();
|
|
|
|
|
// sendVO.setAuxiliarySubstationName();
|
|
|
|
|
@@ -406,10 +470,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
// sendVO.setCableLayingMethod();
|
|
|
|
|
// sendVO.setCableModel();
|
|
|
|
|
// sendVO.setCableRouteLength();
|
|
|
|
|
// sendVO.setMainSubstationId();
|
|
|
|
|
// sendVO.setMainSubstationName();
|
|
|
|
|
// sendVO.setMainVolatageLevel();
|
|
|
|
|
// sendVO.setMonitorNumber();
|
|
|
|
|
|
|
|
|
|
// sendVO.setMonitorNumberTwo();
|
|
|
|
|
// sendVO.setRailwayType();
|
|
|
|
|
// sendVO.setTransformerConnectionGroupMethod();
|
|
|
|
|
@@ -418,18 +479,101 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
// sendVO.setTransformerTwoVoltageLevel();
|
|
|
|
|
// sendVO.setTriphaseVvNameplateCapacity();
|
|
|
|
|
// sendVO.setUploadDate();
|
|
|
|
|
// sendVO.setRunStatus();
|
|
|
|
|
|
|
|
|
|
info.add(sendVO);
|
|
|
|
|
}
|
|
|
|
|
if (info.size() > 100) {
|
|
|
|
|
throw new BusinessException("一次最多上送100条数据");
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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("为查询数据,请查询数据是否存在!");
|
|
|
|
|
}
|
|
|
|
|
SendParam param = new SendParam();
|
|
|
|
|
param.setStats(info);
|
|
|
|
|
Map<String, String> send = GwSendUtil.send(param, GWSendEnum.TRACTION_STATION);
|
|
|
|
|
List<String> trIds = info.stream().map(TractionStationDTO::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
return returnInformation(2, trIds, send);
|
|
|
|
|
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()));
|
|
|
|
|
//电压等级
|
|
|
|
|
List<DictData> voltage = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapVoltage = voltage.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
//运行状态
|
|
|
|
|
List<DictData> lineState = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapLineState = lineState.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
//行业分类
|
|
|
|
|
List<DictData> industryType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.INDUSTRY_TYPE.getCode()).getData();
|
|
|
|
|
Map<String, DictData> mapIndustryType = industryType.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
|
|
|
|
List<OtherUserDto> info = new ArrayList<>();
|
|
|
|
|
OtherUserDto dto;
|
|
|
|
|
for (Monitor monitor : monitorList) {
|
|
|
|
|
dto = new OtherUserDto();
|
|
|
|
|
PvTerminalTreeVO pvTerminalTreeVO;
|
|
|
|
|
BeanUtil.copyProperties(setOrgProvince(mapCode, mapList, monitor.getOrgId()), dto);
|
|
|
|
|
dto.setId(monitor.getId());
|
|
|
|
|
if (mapCode.containsKey(monitor.getOperationId())) {
|
|
|
|
|
pvTerminalTreeVO = mapCode.get(monitor.getOperationId());
|
|
|
|
|
dto.setMaintOrgName(pvTerminalTreeVO.getName());
|
|
|
|
|
dto.setMaintOrg(pvTerminalTreeVO.getCode());
|
|
|
|
|
}
|
|
|
|
|
dto.setConsNo(monitor.getId());
|
|
|
|
|
dto.setConsName(monitor.getName());
|
|
|
|
|
//电压等级
|
|
|
|
|
if (mapVoltage.containsKey(monitor.getVoltageLevel())) {
|
|
|
|
|
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.setSubstationName(monitor.getPowerrName());
|
|
|
|
|
//行业分类
|
|
|
|
|
if (mapIndustryType.containsKey(monitor.getTradeCode())) {
|
|
|
|
|
dto.setTradeCode(mapIndustryType.get(monitor.getTradeCode()).getValue());
|
|
|
|
|
}
|
|
|
|
|
dto.setProtocolCapacity(monitor.getUserAgreementCapacity());
|
|
|
|
|
// dto.setMonitorId(monitor.getId());
|
|
|
|
|
// dto.setIsMonitoringOnline();
|
|
|
|
|
// dto.setIsSceneTest();
|
|
|
|
|
// dto.setHaveDevice();
|
|
|
|
|
// dto.setDeviceType();
|
|
|
|
|
// dto.setDeviceVoltageLevel();
|
|
|
|
|
// dto.setDeviceCapacity();
|
|
|
|
|
|
|
|
|
|
//运行状态
|
|
|
|
|
if (mapLineState.containsKey(monitor.getMonitorState())) {
|
|
|
|
|
dto.setRunStatus(mapLineState.get(monitor.getMonitorState()).getValue());
|
|
|
|
|
}
|
|
|
|
|
dto.setCreateTime(monitor.getCreateTime());
|
|
|
|
|
dto.setUpdateTime(monitor.getUpdateTime());
|
|
|
|
|
info.add(dto);
|
|
|
|
|
}
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
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();
|
|
|
|
|
excelWriter.write(wind, writeSheet);
|
|
|
|
|
|
|
|
|
|
List<PhotovoltaicDto> photovoltaic = this.photovoltaicSend(new ArrayList<>(), Arrays.asList("c5af15b871a5dd880dace02b8f669e2f"));
|
|
|
|
|
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();
|
|
|
|
|
excelWriter.write(sensitive, writeSheet3);
|
|
|
|
|
|
|
|
|
|
List<TractionStationDTO> traction = this.tractionStationSend(new ArrayList<>(), Arrays.asList("2990ed905876f2964393ca64f9bd8d40"));
|
|
|
|
|
WriteSheet writeSheet4 = EasyExcel.writerSheet(3, "牵引站" ).head(TractionStationDTO.class).build();
|
|
|
|
|
excelWriter.write(traction, writeSheet4);
|
|
|
|
|
|
|
|
|
|
List<OtherUserDto> other = this.otherUserSend(new ArrayList<>(), Arrays.asList("08a039a9e3fd4e5038435dfbaa88a8e3"));
|
|
|
|
|
WriteSheet writeSheet5 = EasyExcel.writerSheet(4, "干扰用户" ).head(OtherUserDto.class).build();
|
|
|
|
|
excelWriter.write(other, writeSheet5);
|
|
|
|
|
excelWriter.finish();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -480,13 +624,12 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
* @param powerClients 发电用户
|
|
|
|
|
* @param mapUserClass
|
|
|
|
|
* @param mapEleClass
|
|
|
|
|
* @param mapIndustryType
|
|
|
|
|
* @param mapImportanceLevel
|
|
|
|
|
* @param mapImportanceLevel
|
|
|
|
|
* @param sendVO
|
|
|
|
|
* @param monitor
|
|
|
|
|
*/
|
|
|
|
|
private void setSensitiveUser(List<PowerClient> powerClients,List<PowerGenerationUser> powerGenerationUsers, Map<String, DictData> mapVoltage, Map<String, DictData> mapUserClass, Map<String, DictData> mapEleClass, Map<String, DictData> mapIndustryType, Map<String, DictData> mapImportanceLevel, SensitiveUserDto sendVO, Monitor monitor) {
|
|
|
|
|
private void setSensitiveUser(List<PowerClient> powerClients, List<PowerGenerationUser> powerGenerationUsers, Map<String, DictData> mapVoltage, Map<String, DictData> mapUserClass, Map<String, DictData> mapEleClass, Map<String, DictData> mapImportanceLevel, SensitiveUserDto sendVO, Monitor monitor) {
|
|
|
|
|
DictData dictData;
|
|
|
|
|
if (1 == monitor.getIfPowerUser()) {
|
|
|
|
|
List<PowerClient> powerClientList = powerClients.stream()
|
|
|
|
|
@@ -505,11 +648,6 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
dictData = mapEleClass.get(powerClient.getElectricityType());
|
|
|
|
|
sendVO.setElecTypeCode(dictData.getValue());
|
|
|
|
|
}
|
|
|
|
|
//行业分类
|
|
|
|
|
if (mapIndustryType.containsKey(powerClient.getIndustryType())) {
|
|
|
|
|
dictData = mapIndustryType.get(powerClient.getIndustryType());
|
|
|
|
|
sendVO.setTradeCode(dictData.getValue());
|
|
|
|
|
}
|
|
|
|
|
//重要性等级
|
|
|
|
|
if (mapImportanceLevel.containsKey(powerClient.getImportanceLevel())) {
|
|
|
|
|
dictData = mapImportanceLevel.get(powerClient.getImportanceLevel());
|
|
|
|
|
@@ -521,7 +659,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
sendVO.setConsVoltageLevel(dictData.getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
List<PowerGenerationUser> powerGenerationUserList = powerGenerationUsers.stream()
|
|
|
|
|
.filter(x -> x.getId().equals(monitor.getMonitorObjectId()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
@@ -564,9 +702,7 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
throw new BusinessException("操作失败:" + status + "_" + errors);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// updateIsUploadHead(num, ids);
|
|
|
|
|
throw new BusinessException("当前时间段国网上送请求过多,请稍后再试");
|
|
|
|
|
// return "当前时间段国网上送请求过多,请稍后再试";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -584,12 +720,6 @@ public class MonitorSendServiceImpl implements MonitorSendService {
|
|
|
|
|
.in(Monitor::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
tractionStationService.update(new LambdaUpdateWrapper<TractionStation>()
|
|
|
|
|
.set(TractionStation::getIsUploadHead, 1)
|
|
|
|
|
.in(TractionStation::getId, ids)
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|