|
|
|
@ -3,9 +3,7 @@ package com.xr.iec61850clent.models.iec61850run; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.beanit.iec61850bean.*; |
|
|
|
import com.beanit.iec61850bean.internal.cli.*; |
|
|
|
import com.xr.iec61850clent.common.util.ModeUtil; |
|
|
|
import com.xr.iec61850clent.common.util.SpringUtils; |
|
|
|
import com.xr.iec61850clent.common.util.UploadUtil; |
|
|
|
import com.xr.iec61850clent.common.util.*; |
|
|
|
import com.xr.iec61850clent.models.entity.*; |
|
|
|
import com.xr.iec61850clent.models.service.*; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
@ -28,7 +26,7 @@ public class Iec61850Scheduled { |
|
|
|
private int conner =0; |
|
|
|
String[] args = new String[] {"param1", "param2", "param3"}; |
|
|
|
|
|
|
|
@Scheduled(cron = "0 0/1 * * * ?")//每10分钟执行一次
|
|
|
|
@Scheduled(cron = "0 0 9,15 * * ?")//每天9点和下午三点执行
|
|
|
|
public void run(){ |
|
|
|
StringCliParameter hostParam = new CliParameterBuilder("-h") .setDescription("要访问的服务器的IP域地址。").buildStringParameter("host","192.168.1.93"); |
|
|
|
IntCliParameter portParam = new CliParameterBuilder("-p").setDescription("要连接的端口。").buildIntParameter("port", 102); |
|
|
|
@ -133,9 +131,6 @@ public class Iec61850Scheduled { |
|
|
|
if(lds5000==null){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
if(lds5000.getClentIp().equals("192.168.1.57")){ |
|
|
|
System.out.println("-----------------------"); |
|
|
|
} |
|
|
|
QueryWrapper<Lds5000> queryWrapper=new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("node",lds5000.getNode()); |
|
|
|
queryWrapper.eq("clent_ip","192.168.1.93"); |
|
|
|
@ -159,13 +154,22 @@ public class Iec61850Scheduled { |
|
|
|
if(node.getFc().name().equals("MX")){ |
|
|
|
String value = "0"; |
|
|
|
float f = Float.valueOf(lds5000.getF()); |
|
|
|
if(config.getTypeId() == 3 || config.getTypeId() == 5 || config.getTypeId() == 7){//油位计,保留2位小数
|
|
|
|
if(config.getTypeId() == 5 || config.getTypeId() == 7){ |
|
|
|
if(f ==0 && StringUtils.isNotEmpty(config.getJzVal())){ |
|
|
|
value = config.getJzVal(); |
|
|
|
}else{ |
|
|
|
value = String.format("%.2f", f); |
|
|
|
} |
|
|
|
} |
|
|
|
if(config.getTypeId() == 3 ){ |
|
|
|
if((f == 0 || f>1)&& StringUtils.isNotEmpty(config.getJzVal())){ |
|
|
|
value = config.getJzVal(); |
|
|
|
}else{ |
|
|
|
value = String.format("%.2f", f*100)+"%"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(config.getTypeId() == 4 || config.getTypeId() == 11){//开关计数器
|
|
|
|
//处理为整数
|
|
|
|
int s = (int) f; |
|
|
|
value = s+""; |
|
|
|
value= ValueFormatUtil.getNumBerJx(f,config,meterConfigService); |
|
|
|
} |
|
|
|
if(config.getTypeId() == 8){//档位数据处理
|
|
|
|
//处理为整数
|
|
|
|
@ -195,6 +199,8 @@ public class Iec61850Scheduled { |
|
|
|
int s = Math.round(f); |
|
|
|
if(s>=10){ |
|
|
|
value = 0+""; |
|
|
|
}else { |
|
|
|
value = s+""; |
|
|
|
} |
|
|
|
} |
|
|
|
if(config.getIsJz() == 1){ |
|
|
|
@ -216,11 +222,8 @@ public class Iec61850Scheduled { |
|
|
|
meterReadingRecord.setReadingUrl(url1); |
|
|
|
meterReadingRecord.setMeterTypeId(config.getTypeId()); |
|
|
|
meterReadingRecord.setOwningInterval(config.getOwningInterval()); |
|
|
|
if(config.getIsJz()!=1){ |
|
|
|
meterReadingRecordService.save(meterReadingRecord); |
|
|
|
} |
|
|
|
//abnormalReadingJudgment(meterReadingRecord);
|
|
|
|
} |
|
|
|
}else{ |
|
|
|
lds5000.setCreateTime(new Date()); |
|
|
|
lds5000Service.save(lds5000); |
|
|
|
|