@@ -20,6 +20,7 @@ import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO ;
import com.njcn.device.biz.pojo.param.DeptGetLineParam ;
import com.njcn.device.biz.pojo.po.DeviceBak ;
import com.njcn.device.biz.utils.COverlimit ;
import com.njcn.device.biz.utils.COverlimitUtil ;
import com.njcn.device.pms.enums.PmsDeviceResponseEnum ;
@@ -98,6 +99,8 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
private final LineBakMapper lineBakMapper ;
private final DeviceBakMapper deviceBakMapper ;
@Override
public List < PmsMonitorBaseDTO > getMonitorByCondition ( List < String > deptIdList , PmsDeviceInfoParam pmsDeviceInfoParam ) {
@@ -390,28 +393,29 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
}
@Override
public boolean importOracleLedgerToMysql ( MultipartFile file , HttpServletResponse response ) {
@Transactional ( rollbackFor = Exception . class )
public String importOracleLedgerToMysql ( MultipartFile file , HttpServletResponse response ) {
ImportParams importParams = new ImportParams ( ) ;
importParams . setHeadRows ( 1 ) ;
importParams . setTitleRows ( 1 ) ;
importParams . setNeedVerify ( true ) ;
try {
ExcelImportResult < OracleTerminalExcel > terminalExcelExcelImportResult = ExcelImportUtil . importExcelMore ( file . getInputStream ( ) , OracleTerminalExcel . class , importParams ) ;
//如果存在非法数据,将不合格的数据导出
if ( terminalExcelExcelImportResult . isVerifyFail ( ) ) {
PoiUtil . exportFileByWorkbook ( terminalExcelExcelImportResult . getFailWorkbook ( ) , " 非法台账信息.xlsx " , response ) ;
return null ;
} else {
//执行台账信息导入(不考虑,存在监测点却不存在限值信息)
dealData ( terminalExcelExcelImportResult . getList ( ) ) ;
return dealData ( terminalExcelExcelImportResult . getList ( ) ) ;
}
} catch ( Exception e ) {
e . printStackTrace ( ) ;
throw new BusinessException ( DeviceResponseEnum . IMPORT_ORACLE_EXCEPTION ) ;
}
return true ;
}
@@ -499,11 +503,6 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
throw new BusinessException ( SystemResponseEnum . MONITOR_TAG_EMPTY ) ;
}
//校验监测对象类型
DictData objTypeDic = dicDataFeignClient . getDicDataById ( monitorParam . getMonitorObjectType ( ) ) . getData ( ) ;
if ( Objects . isNull ( objTypeDic ) ) {
throw new BusinessException ( SystemResponseEnum . MONITORY_TYPE_EMPTY ) ;
}
//校验监测终端接线方式
DictData wireDic = dicDataFeignClient . getDicDataById ( monitorParam . getTerminalWiringMethod ( ) ) . getData ( ) ;
@@ -590,6 +589,23 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
List < DictData > manList = dicDataFeignClient . getDicDataByTypeCode ( DicDataTypeEnum . DEV_MANUFACTURER . getCode ( ) ) . getData ( ) ;
Map < String , DictData > manDicMap = manList . stream ( ) . collect ( Collectors . toMap ( DictData : : getName , Function . identity ( ) ) ) ;
//装作等级
DictData devGrade = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . DEV_GRADE . getName ( ) , DicDataEnum . MOST_IMPORMENT . getName ( ) ) . getData ( ) ;
//
DictData devInputType = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . INPUT_SIGNAL . getName ( ) , DicDataEnum . SIMULATION_SIGNAL . getName ( ) ) . getData ( ) ;
//监测点类型
DictData monitorType = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . LINE_TYPE . getName ( ) , DicDataEnum . Power_Supply_Point . getName ( ) ) . getData ( ) ;
//接线方式
List < DictData > wireList = dicDataFeignClient . getDicDataByTypeCode ( DicDataTypeEnum . DEV_CONNECT . getCode ( ) ) . getData ( ) ;
Map < String , DictData > wireListMap = wireList . stream ( ) . collect ( Collectors . toMap ( DictData : : getName , Function . identity ( ) ) ) ;
DictData potentialDic = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . VOLTAGE_TRANSFORMER . getName ( ) , DicDataEnum . Cap_V . getName ( ) ) . getData ( ) ;
DictData neutralDic = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . Neutral_Point . getName ( ) , DicDataEnum . Ground_Res . getName ( ) ) . getData ( ) ;
for ( OracleTerminalExcel oracleTerminalExcel : oracleTerminalExcelList ) {
//单位
@@ -599,12 +615,9 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
}
//判断是否操作过该条记录
LineBak lineBak = lineBakMapper . selectBy Id ( oracleTerminalExcel . getId ( ) ) ;
if ( Objects . nonNull ( lineBak ) ) {
//不为空默认已经存在监测点,提示先删除对应监测点
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " mysql库中已经存在该监测点, 请先删除监测点 " ) ) ;
continue ;
}
LineBak lineBak = lineBakMapper . selectOne ( new LambdaQueryWrapper < LineBak > ( ) . eq ( LineBak : : getLine Id , oracleTerminalExcel . getId ( ) ) ) ;
DeviceBak deviceBak = deviceBakMapper . selectOne ( new LambdaQueryWrapper < DeviceBak > ( ) . eq ( DeviceBak : : getDevId , oracleTerminalExcel . getDeviceId ( ) ) ) ;
//单位
@@ -617,111 +630,127 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
. eq ( StatationStat : : getOrgId , deptDTO . getCode ( ) ) ;
StatationStat statationStat = statationStatMapper . selectOne ( statLambdaQueryWrapper ) ;
if ( Objects . isNull ( s tatationStat) ) {
StatationStat statationStatPO = new StatationStat ( ) ;
statationStatPO . setOrgId ( deptDTO . getCod e ( ) ) ;
statationStatPO . setOrg Name ( deptDTO . get Name( ) ) ;
statationStatPO . setPowerNam e ( oracleTerminalExcel . getSubstationNam e ( ) ) ;
statationStatPO . setLong itude ( oracleTerminalExcel . getLng ( ) . doubleValue ( ) ) ;
statationStatPO . setLatitude ( oracleTerminalExcel . getLat ( ) . doubleValue ( ) ) ;
statationStatPO . setShouldBeNum ( 100 ) ;
statationStatPO . setStatus ( DataStateEnum . ENABLE . getCode ( ) ) ;
StatationStat statationStatPO = new S tatationStat( ) ;
statationStatPO . setOrgId ( deptDTO . getCode ( ) ) ;
statationStatPO . setOrgName ( deptDTO . getNam e ( ) ) ;
statationStatPO . setPower Name ( oracleTerminalExcel . getSubstation Name( ) ) ;
statationStatPO . setLongitud e ( oracleTerminalExcel . getLng ( ) . doubleValu e ( ) ) ;
statationStatPO . setLat itude ( oracleTerminalExcel . getLat ( ) . doubleValue ( ) ) ;
statationStatPO . setShouldBeNum ( 100 ) ;
statationStatPO . setStatus ( DataStateEnum . ENABLE . getCode ( ) ) ;
String dicVoltage = dealVoltageLevel ( oracleTerminalExcel . getSubStationScale ( ) ) ;
if ( voltageLevelMap . containsKey ( dicVoltage ) ) {
statationStatPO . setVoltageLevel ( voltageLevelMap . get ( dicVoltage ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 变电站电压等级不存在,请确认电压等级存在 " ) ) ;
continue ;
}
String dicVoltage = dealVoltageLevel ( oracleTerminalExcel . getSubStationScale ( ) ) ;
if ( voltageLevelMap . containsKey ( dicVoltage ) ) {
statationStatPO . setVoltageLevel ( voltageLevelMap . get ( dicVoltage ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典 变电站电压等级不存在,请确认电压等级存在" ) ) ;
continue ;
}
if ( Objects . isNull ( statationStat ) ) {
statationStatMapper . insert ( statationStatPO ) ;
stationId = statationStatPO . getPowerId ( ) ;
stationName = statationStatPO . getPowerName ( ) ;
} else {
//更新信息
statationStatPO . setPowerId ( statationStat . getPowerId ( ) ) ;
statationStatMapper . updateById ( statationStatPO ) ;
stationId = statationStat . getPowerId ( ) ;
stationName = statationStat . getPowerName ( ) ;
}
//装置
String devId = null ;
LambdaQueryWrapper < PmsTerminal > terminalLambdaQueryWrapper = new LambdaQueryWrapper < > ( ) ;
terminalLambdaQueryWrapper . eq ( PmsTerminal : : getName , oracleTerminalExcel . getDeviceName ( ) )
. eq ( PmsTerminal : : getPowerStationId , stationId ) ;
PmsTerminal pmsTerminal = terminalMapper . selectOne ( terminalLambdaQueryWrapper ) ;
if ( Objects . isNull ( pmsTerminal ) ) {
PmsTerminal pmsTerminalPO = new PmsTerminal ( ) ;
pmsTerminalPO . setOrgId ( deptDTO . getCode ( ) ) ;
pmsTerminalPO . setOrgName ( deptDTO . getName ( ) ) ;
pmsTerminalPO . setName ( oracleTerminalExcel . getDeviceName ( ) ) ;
pmsTerminalPO . setOperationId ( deptDTO . getCode ( ) ) ;
pmsTerminalPO . setOperationName ( deptDTO . getName ( ) ) ;
pmsTerminalPO . setPowerrName ( stationName ) ;
pmsTerminalPO . setPowerStationId ( stationId ) ;
pmsTerminalPO . setIp ( oracleTerminalExcel . getIp ( ) ) ;
pmsTerminalPO . setUseDate ( oracleTerminalExcel . getLoginTime ( ) ) ;
pmsTerminalPO . setVerificationDate ( oracleTerminalExcel . getThisTimeCheck ( ) ) ;
p msTerminalPO . setDeviceCategory ( devCategoryDic . getId ( ) ) ;
P msTerminal pmsTerminalPO = new PmsTerminal ( ) ;
pmsTerminalPO . setOrgId ( deptDTO . getCode ( ) ) ;
pmsTerminalPO . setOrgName ( deptDTO . getName ( ) ) ;
pmsTerminalPO . setName ( oracleTerminalExcel . getDeviceName ( ) ) ;
pmsTerminalPO . setOperationId ( deptDTO . getCode ( ) ) ;
pmsTerminalPO . setOperationName ( deptDTO . getName ( ) ) ;
pmsTerminalPO . setPowerrName ( stationName ) ;
pmsTerminalPO . setPowerStationId ( stationId ) ;
pmsTerminalPO . setIp ( oracleTerminalExcel . getIp ( ) ) ;
pmsTerminalPO . setUseDate ( oracleTerminalExcel . getLoginTime ( ) ) ;
pmsTerminalPO . setVerificationDate ( oracleTerminalExcel . getThisTimeCheck ( ) ) ;
pmsTerminalPO . setDeviceCategory ( devCategoryDic . getId ( ) ) ;
if ( devTypelDicMap . containsKey ( oracleTerminalExcel . getDevType ( ) ) ) {
pmsTerminalPO . setDeviceModel ( devTypelDicMap . get ( oracleTerminalExcel . getDevType ( ) ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 装置类型不存在,请确认后重试 " ) ) ;
continue ;
}
//终端状态
if ( devTypelDicMap . containsKey ( oracleTerminalExcel . getDevType ( ) ) ) {
pmsTerminalPO . setDeviceModel ( devTypelDicMap . get ( oracleTerminalExcel . getDevType ( ) ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典装置类型不存在,请确认后重试 " ) ) ;
continue ;
}
String devState = null ;
switch ( oracleTerminalExcel . getRunFlag ( ) ) {
case 0 :
devState = DicDataEnum . RUNNING . getName ( ) ;
break ;
case 1 :
devState = DicDataEnum . NOT_OPERATION . getName ( ) ;
break ;
case 2 :
devState = DicDataEnum . RETIRE . getName ( ) ;
break ;
}
if ( devStateDicMap . containsKey ( devState ) ) {
pmsTerminalPO . setTerminalState ( devTypelDicMap . get ( oracleTerminalExcel . getDevType ( ) ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典装置运行状态不存在,请确认后重试 " ) ) ;
continue ;
}
DictData devGrade = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . DEV_GRADE . getName ( ) , DicDataEnum . MOST_IMPORMENT . getName ( ) ) . getData ( ) ;
pmsTerminalPO . setTerminalLevel ( devGrade . getId ( ) ) ;
DictData devInputType = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . INPUT_SIGNAL . getName ( ) , DicDataEnum . SIMULATION_SIGNAL . getName ( ) ) . getData ( ) ;
pmsTerminalPO . setInputType ( devInputType . getId ( ) ) ;
if ( devTypelDicMap . containsKey ( oracleTerminalExcel . getDevType ( ) ) ) {
pmsTerminalPO . setDeviceModel ( devTypelDicMap . get ( oracleTerminalExcel . getDevType ( ) ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典 装置类型不存在,请确认后重试" ) ) ;
continue ;
}
/* if (devTypelDicMap.containsKey(oracleTerminalExcel.getDevType())) {
pmsTerminalPO.setTerminalState(devTypelDicMap.get(oracleTerminalExcel.getDevType()).getId());
} else {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "字典终端状态不存在,请确认后重试"));
continue;
}*/
pmsTerminalPO . setStatus ( DataStateEnum . ENABLE . getCode ( ) ) ;
pmsTerminalPO . setPort ( oracleTerminalExcel . getPort ( ) . toString ( ) ) ;
pms TerminalPO . s etIsUpToGrid ( 0 ) ;
if ( manDicMap . containsKey ( oracleTerminalExcel . getManufacturer ( ) ) ) {
pmsTerminalPO . setManufacture ( manDicMap . get ( oracleTerminalExcel . getManufacturer ( ) ) . getId ( ) ) ;
} el se {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典制造厂商不存在,请确认后重试 " ) ) ;
continue ;
}
//终端状态
String devState = null ;
switch ( oracle TerminalExcel . g etRunFlag ( ) ) {
case 0 :
devState = DicDataEnum . RUNNING . getName ( ) ;
break ;
ca se 1 :
devState = DicDataEnum . NOT_OPERATION . getName ( ) ;
break ;
case 2 :
devState = DicDataEnum . RETIRE . getName ( ) ;
break ;
}
if ( devStateDicMap . containsKey ( devState ) ) {
pmsTerminalPO . setTerminalState ( devStateDicMap . get ( devState ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典装置运行状态不存在,请确认后重试 " ) ) ;
continue ;
}
pmsTerminalPO . setTerminalLevel ( devGrade . getId ( ) ) ;
pmsTerminalPO . setInputType ( devInputType . getId ( ) ) ;
pmsTerminalPO . setStatus ( DataStateEnum . ENABLE . getCode ( ) ) ;
pmsTerminalPO . setPort ( oracleTerminalExcel . getPort ( ) . toString ( ) ) ;
pmsTerminalPO . setIsUpToGrid ( 0 ) ;
if ( manDicMap . containsKey ( oracleTerminalExcel . getManufacturer ( ) ) ) {
pmsTerminalPO . setManufacture ( manDicMap . get ( oracleTerminalExcel . getManufacturer ( ) ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典制造厂商不存在,请确认后重试 " ) ) ;
continue ;
}
if ( Objects . isNull ( pmsTerminal ) & & Objects . isNull ( deviceBak ) ) {
terminalMapper . insert ( pmsTerminalPO ) ;
devId = pmsTerminalPO . getId ( ) ;
DeviceBak deviceBakPO = new DeviceBak ( ) ;
deviceBakPO . setId ( devId ) ;
deviceBakPO . setDevId ( oracleTerminalExcel . getDeviceId ( ) ) ;
deviceBakMapper . insert ( deviceBakPO ) ;
} else {
devId = pmsTerminal . getId ( ) ;
if ( Objects . isNull ( deviceBak ) ) {
pmsTerminalPO . setId ( pmsTerminal . getId ( ) ) ;
DeviceBak deviceBakPO = new DeviceBak ( ) ;
deviceBakPO . setId ( pmsTerminal . getId ( ) ) ;
deviceBakPO . setDevId ( oracleTerminalExcel . getDeviceId ( ) ) ;
deviceBakMapper . insert ( deviceBakPO ) ;
terminalMapper . updateById ( pmsTerminalPO ) ;
devId = pmsTerminal . getId ( ) ;
} else if ( Objects . isNull ( pmsTerminal ) ) {
terminalMapper . deleteById ( deviceBak . getId ( ) ) ;
pmsTerminalPO . setId ( deviceBak . getId ( ) ) ;
terminalMapper . insert ( pmsTerminalPO ) ;
devId = pmsTerminalPO . getId ( ) ;
} else {
devId = pmsTerminal . getId ( ) ;
}
}
//线路
@@ -732,149 +761,140 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
String lineId = null , lineName = null , genScale = null ;
if ( Objects . isNull ( generatrixWire ) ) {
GeneratrixWire generatrixWirePO = new GeneratrixWire ( ) ;
generatrixWirePO . setGeneratrixName ( oracleTerminalExcel . getSubvName ( ) ) ;
generatrixWirePO . setStatus ( DataStateEnum . ENABLE . getCode ( ) ) ;
generatrixWirePO . setName ( oracleTerminalExcel . getSubvName ( ) ) ;
generatrixWirePO . setOrgId ( deptDTO . getCode ( ) ) ;
generatrixWirePO . setStationId ( stationId ) ;
generatrixWirePO . setStationName ( stationName ) ;
String dicVoltage = dealVoltageLevel ( oracleTerminalExcel . getSubvScal e ( ) ) ;
if ( voltageLevelMap . containsKey ( dicVoltag e ) ) {
DictData temVoltage = voltageLevelMap . get ( dicVoltage ) ;
generatrixWirePO . setScal e ( temVoltage . getId ( ) ) ;
}
GeneratrixWire generatrixWirePO = new GeneratrixWir e ( ) ;
generatrixWirePO . setGeneratrixName ( oracleTerminalExcel . getSubvNam e ( ) ) ;
generatrixWirePO . setStatus ( DataStateEnum . ENABLE . getCode ( ) ) ;
generatrixWirePO . setNam e ( oracleTerminalExcel . getSubvName ( ) ) ;
generatrixWirePO . setOrgId ( deptDTO . getCode ( ) ) ;
generatrixWirePO . setStationId ( stationId ) ;
generatrixWirePO . setStationName ( stationName ) ;
String dicVoltagePms = dealVoltageLevel ( oracleTerminalExcel . getSubvScale ( ) ) ;
if ( voltageLevelMap . containsKey ( dicVoltagePms ) ) {
DictData temVoltage = voltageLevelMap . get ( dicVoltagePms ) ;
generatrixWirePO . setScale ( temVoltage . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典母线电压等级不存在,请确认后重试 " ) ) ;
continue ;
}
if ( Objects . isNull ( generatrixWire ) ) {
generatrixWireMapper . insert ( generatrixWirePO ) ;
lineId = generatrixWirePO . getId ( ) ;
lineName = generatrixWirePO . getName ( ) ;
genScale = generatrixWirePO . getScale ( ) ;
} else {
generatrixWirePO . setId ( generatrixWire . getId ( ) ) ;
generatrixWireMapper . updateById ( generatrixWirePO ) ;
lineId = generatrixWire . getId ( ) ;
lineName = generatrixWire . getName ( ) ;
genScale = generatrixWire . getScale ( ) ;
lineName = generatrixWirePO . getName ( ) ;
genScale = generatrixWirePO . getScale ( ) ;
}
//监测点
LambdaQueryWrapper < Monitor > monitorLambdaQueryWrapper = new LambdaQueryWrapper < > ( ) ;
monitorLambdaQueryWrapper . eq ( Monitor : : getPowerr Id , station Id)
monitorLambdaQueryWrapper . eq ( Monitor : : getLine Id , line Id)
. eq ( Monitor : : getName , oracleTerminalExcel . getLineName ( ) ) ;
Monitor monitor = monitorMapper . selectOne ( monitorLambdaQueryWrapper ) ;
if ( Objects . isNull ( monitor ) ) {
//当前电站下面没有监测点,可以新增
Monitor monitorPO = new Monitor ( ) ;
monitorPO . setName ( oracleTerminalExcel . getLineName ( ) ) ;
monitorPO . setPowerrName ( stationName ) ;
monitorPO . setPowerrId ( stationId ) ;
monitorPO . setOperationName ( deptDTO . getName ( ) ) ;
monitorPO . setOperationId ( deptDTO . getCode ( ) ) ;
monitorPO . setOrgName ( deptDTO . getName ( ) ) ;
monitorPO . setOrgId ( deptDTO . getCode ( ) ) ;
monitorPO . setLineName ( lineName ) ;
monitorPO . setLineId ( lineId ) ;
monitorPO . setVoltageLevel ( genScale ) ;
String monitorState = null ;
switch ( oracleTerminalExcel . getRunFlag ( ) ) {
case 0 :
monitorState = DicDataEnum . RUN . getName ( ) ;
break ;
case 1 :
monitorState = DicDataEnum . DEBUGGING . getName ( ) ;
break ;
case 2 :
monitorState = DicDataEnum . DECOMMISSIONING . getName ( ) ;
break ;
default :
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典监测点状态不存在,请确认后重试 " ) ) ;
break ;
}
if ( monitorStateDicMap . containsKey ( monitorState ) ) {
monitorPO . setMonitorState ( monitorStateDicMap . get ( monitorState ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典监测点运行状态不存在,请确认后重试 " ) ) ;
continue ;
}
DictData monitorType = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . LINE_TYPE . getName ( ) , DicDataEnum . Power_Supply_Point . getName ( ) ) . getData ( ) ;
monitorPO . setMonitorType ( monitorType . getId ( ) ) ;
monitorPO . setStandShortCapacity ( oracleTerminalExcel . getStandardCapacity ( ) ) ;
monitorPO . setMinShortCircuitCapacity ( oracleTerminalExcel . getShortCapacity ( ) ) ;
monitorPO . setUserAgreementCapacity ( oracleTerminalExcel . getDealCapacity ( ) ) ;
monitorPO . setPowerSupplyEqCapacity ( oracleTerminalExcel . getDevCapacity ( ) ) ;
DictData scale = dicDataFeignClient . getDicDataById ( monitorPO . getVoltageLevel ( ) ) . getData ( ) ;
Overlimit overlimitTem = new Overlimit ( ) ;
COverlimitUtil . voltageDeviation ( overlimitTem , Float . parseFloat ( scale . getValue ( ) ) ) ;
monitorPO . setVoltageDeviationLowerLimit ( overlimitTem . getVoltageDev ( ) ) ;
monitorPO . setVoltageDeviationUpperLimit ( overlimitTem . getUvoltageDev ( ) ) ;
DictData potentialDic = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . VOLTAGE_TRANSFORMER . getName ( ) , DicDataEnum . Cap_V . getName ( ) ) . getData ( ) ;
m onitorPO . setPotentialTransFormerType ( potentialDic . getId ( ) ) ;
//当前电站下面没有监测点,可以新增
M onitor monitorPO = new Monitor ( ) ;
monitorPO . setName ( oracleTerminalExcel . getLineName ( ) ) ;
monitorPO . setPowerrName ( stationName ) ;
monitorPO . setPowerrId ( stationId ) ;
monitorPO . setOperationName ( deptDTO . getName ( ) ) ;
monitorPO . setOperationId ( deptDTO . getCode ( ) ) ;
monitorPO . setOrgName ( deptDTO . getName ( ) ) ;
monitorPO . setOrgId ( deptDTO . getCode ( ) ) ;
monitorPO . setLineName ( lineName ) ;
monitorPO . setLineId ( lineId ) ;
monitorPO . setVoltageLevel ( genScale ) ;
DictData neutralDic = dicDataFeignClient . getDicDataByNameAndTypeName ( DicDataTypeEnum . Neutral_Point . getName ( ) , DicDataEnum . Ground_Res . getName ( ) ) . getData ( ) ;
monitorPO . setNeutralGroundingMode ( neutralDic . getId ( ) ) ;
String monitorState = null ;
switch ( oracleTerminalExcel . getRunFlag ( ) ) {
case 0 :
monitorState = DicDataEnum . RUN . getName ( ) ;
break ;
case 1 :
monitorState = DicDataEnum . DEBUGGING . getName ( ) ;
break ;
case 2 :
monitorState = DicDataEnum . DECOMMISSIONING . getName ( ) ;
break ;
default :
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典监测点状态不存在,请确认后重试 " ) ) ;
break ;
monitorPO . setIsSpecialSupplyElectricity ( 0 ) ;
}
if ( monitorStateDicMap . containsKey ( monitorState ) ) {
monitorPO . setMonitorState ( monitorStateDicMap . get ( monitorState ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典监测点运行状态不存在,请确认后重试 " ) ) ;
continue ;
}
monitorPO . setMonitorType ( monitorType . getId ( ) ) ;
monitorPO . setStandShortCapacity ( oracleTerminalExcel . getStandardCapacity ( ) ) ;
monitorPO . setMinShortCircuitCapacity ( oracleTerminalExcel . getShortCapacity ( ) ) ;
monitorPO . setUserAgreementCapacity ( oracleTerminalExcel . getDealCapacity ( ) ) ;
monitorPO . setPowerSupplyEqCapacity ( oracleTerminalExcel . getDevCapacity ( ) ) ;
DictData scale = dicDataFeignClient . getDicDataById ( monitorPO . getVoltageLevel ( ) ) . getData ( ) ;
Overlimit overlimitTem = new Overlimit ( ) ;
COverlimitUtil . voltageDeviation ( overlimitTem , Float . parseFloat ( scale . getValue ( ) ) ) ;
monitorPO . setVoltageDeviationLowerLimit ( overlimitTem . getUvoltageDev ( ) ) ;
monitorPO . setVoltageDeviationUpperLimit ( overlimitTem . getVoltageDev ( ) ) ;
monitorPO . setPotentialTransFormerType ( potentialDic . getId ( ) ) ;
monitorPO . setNeutralGroundingMode ( neutralDic . getId ( ) ) ;
monitorPO . setStatisticalInterval ( oracleTerminalExcel . getTimeInterval ( ) ) ;
monitorPO . setTerminalId ( devId ) ;
monitorPO . setIsSpecialSupplyElectricity ( 0 ) ;
if ( objTypeDicMap . containsKey ( oracleTerminalExcel . getLoadType ( ) ) ) {
String objTypeId = objTypeDicMap . get ( oracleTerminalExcel . getLoadType ( ) ) . getId ( ) ;
monitorPO . setMonitorTag ( objTypeId ) ;
monitorPO . setMonitorObjectType ( objTypeId ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典监测对象类型不存在,请确认后重试 " ) ) ;
continue ;
}
if ( objTypeDicMap . containsKey ( oracleTerminalExcel . getLoadType ( ) ) ) {
String objTypeId = objTypeDicMap . get ( oracleTerminalExcel . getLoadType ( ) ) . getId ( ) ;
monitorPO . setMonitorTag ( objTypeId ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典监测对象类型不存在,请确认后重试 " ) ) ;
continue ;
}
monitorPO . setStatisticalInterval ( oracleTerminalExcel . getTimeInterval ( ) ) ;
monitorPO . setTerminalId ( devId ) ;
//接线方式
List < DictData > wireList = dicDataFeignClient . getDicDataByTypeCode ( DicDataTypeEnum . DEV_CONNECT . getCode ( ) ) . getData ( ) ;
Map < String , DictData > wireListMap = wireList . stream ( ) . collect ( Collectors . toMap ( DictData : : getName , Function . identity ( ) ) ) ;
String wireMethod = " " ;
switch ( oracleTerminalExcel . getPtType ( ) ) {
case 0 :
wireMethod = DicDataEnum . STAR . getName ( ) ;
break ;
case 1 :
wireMethod = DicDataEnum . STAR_TRIANGLE . getName ( ) ;
break ;
case 2 :
wireMethod = DicDataEnum . OPEN_DELTA . getName ( ) ;
break ;
default :
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典接线方式不存在,请确认后重试 " ) ) ;
break ;
}
if ( wireListMap . containsKey ( wireMethod ) ) {
monitorPO . setTerminalWiringMethod ( wireListMap . get ( wireMethod ) . getId ( ) ) ;
} else {
String wireMethod = " " ;
switch ( oracleTerminalExcel . getPtType ( ) ) {
case 0 :
wireMethod = DicDataEnum . STAR . getName ( ) ;
break ;
case 1 :
wireMethod = DicDataEnum . STAR_TRIANGLE . getName ( ) ;
break ;
case 2 :
wireMethod = DicDataEnum . OPEN_DELTA . getName ( ) ;
break ;
default :
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典接线方式不存在,请确认后重试 " ) ) ;
continue ;
}
monitorPO . setIsUpToGrid ( 0 ) ;
monitorPO . setStatus ( DataStateEnum . ENABLE . getCode ( ) ) ;
monitorPO . setIsSpecialMonitor ( 0 ) ;
monitorPO . setPt1 ( oracleTerminalExcel . getPt1 ( ) ) ;
monitorPO . setPt2 ( oracleTerminalExcel . getPt2 ( ) ) ;
monitorPO . setCt1 ( oracleTerminalExcel . getCt1 ( ) ) ;
monitorPO . setCt2 ( oracleTerminalExcel . getCt2 ( ) ) ;
break ;
}
if ( wireListMap . containsKey ( wireMethod ) ) {
monitorPO . setTerminalWiringMethod ( wireListMap . get ( wireMethod ) . getId ( ) ) ;
} else {
oracleTerminalExcelMsg . add ( assembleMsg ( oracleTerminalExcel , " 字典接线方式不存在,请确认后重试 " ) ) ;
continue ;
}
monitorPO . setIsUpToGrid ( 0 ) ;
monitorPO . setStatus ( DataStateEnum . ENABLE . getCode ( ) ) ;
monitorPO . setIsSpecialMonitor ( 0 ) ;
monitorPO . setPt1 ( oracleTerminalExcel . getPt1 ( ) ) ;
monitorPO . setPt2 ( oracleTerminalExcel . getPt2 ( ) ) ;
monitorPO . setCt1 ( oracleTerminalExcel . getCt1 ( ) ) ;
monitorPO . setCt2 ( oracleTerminalExcel . getCt2 ( ) ) ;
if ( Objects . isNull ( lineBak ) & & Objects . isNull ( monitor ) ) {
monitorMapper . insert ( monitorPO ) ;
Overlimit overlimit = COverlimitUtil . globalAssemble ( Float . parseFloat ( scale . getValue ( ) ) , oracleTerminalExcel . getDealCapacity ( ) , oracleTerminalExcel . getDevCapacity ( ) , oracleTerminalExcel . getShortCapacity ( ) , 0 , 0 ) ;
overlimit . setId ( monitorPO . getId ( ) ) ;
Overlimit overlimitRes = overlimitMapper . selectById ( monitorPO . getId ( ) ) ;
if ( Objects . isNull ( overlimitRes ) ) {
overlimitMapper . insert ( overlimit ) ;
@@ -886,6 +906,19 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
lineBakPO . setId ( monitorPO . getId ( ) ) ;
lineBakPO . setLineId ( oracleTerminalExcel . getId ( ) ) ;
lineBakMapper . insert ( lineBakPO ) ;
} else {
if ( Objects . isNull ( lineBak ) ) {
LineBak lineBakPO = new LineBak ( ) ;
lineBakPO . setId ( monitor . getId ( ) ) ;
lineBakPO . setLineId ( oracleTerminalExcel . getId ( ) ) ;
lineBakMapper . insert ( lineBakPO ) ;
monitorMapper . updateById ( monitorPO ) ;
} else if ( Objects . isNull ( monitor ) ) {
monitorMapper . deleteById ( lineBak . getId ( ) ) ;
monitorPO . setId ( lineBak . getId ( ) ) ;
monitorMapper . insert ( monitorPO ) ;
}
}
@@ -900,7 +933,7 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
private String dealVoltageLevel ( String voltage ) {
in t scale = Integer . parseIn t ( voltage . substring ( 0 , voltage . indexOf ( " kV " ) ) ) ;
floa t scale = Float . parseFloa t ( voltage . substring ( 0 , voltage . indexOf ( " kV " ) ) ) ;
if ( scale < 500 ) {
return " 交流 " + voltage ;
} else {