1、将异常设备编号放入配置文件

This commit is contained in:
weidong 2025-03-01 11:10:31 +08:00
parent c2e594a444
commit 056e1a5e21
3 changed files with 25 additions and 6 deletions

View File

@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -38,7 +39,8 @@ public class WarningServiceImpl implements WarningService {
// warning type <-> level & value // warning type <-> level & value
Map<Integer, int[]> cfgMap = new ConcurrentHashMap<>(); Map<Integer, int[]> cfgMap = new ConcurrentHashMap<>();
int warningLevel2Code = 0; int warningLevel2Code = 0;
@Value("${abnormal.check_list}")
private String checkList;
@PostConstruct @PostConstruct
@Override @Override
public void refreshCfg(){ public void refreshCfg(){
@ -361,6 +363,9 @@ public class WarningServiceImpl implements WarningService {
@Override @Override
public void checkFilteredResultJump(double[] latestRpos, GnssCalcData locationRecord){ public void checkFilteredResultJump(double[] latestRpos, GnssCalcData locationRecord){
if(StringUtils.hasText(checkList)){
if(checkList.contains(locationRecord.getDeviceid())) return;
}
int[] warningValuesXY = cfgMap.get(WarningCfg.TYPE_XY_JUMP); int[] warningValuesXY = cfgMap.get(WarningCfg.TYPE_XY_JUMP);
int[] warningValuesZ = cfgMap.get(WarningCfg.TYPE_Z_JUMP); int[] warningValuesZ = cfgMap.get(WarningCfg.TYPE_Z_JUMP);
int warningCode = 0; int warningCode = 0;

View File

@ -8,10 +8,12 @@ import com.imdroid.sideslope.sal.DeviceService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -35,6 +37,10 @@ public class AbnormalDeviceProcessor{
GnssGroupCalcMapper groupCalcMapper; GnssGroupCalcMapper groupCalcMapper;
@Autowired @Autowired
GnssCalcDataMapper dataMapper; GnssCalcDataMapper dataMapper;
@Value("${abnormal.check_list}")
private String checkList;
@Value("${abnormal.refer_list}")
private String referList;
// 非线程安全需加同步保护 // 非线程安全需加同步保护
List<GnssGroupCalc> groupCalcList; List<GnssGroupCalc> groupCalcList;
@ -51,14 +57,19 @@ public class AbnormalDeviceProcessor{
return null; return null;
} }
@Scheduled(cron = "0 0/10 * * * ?") // 30分钟执行一次 @Scheduled(cron = "0 0/10 * * * ?") // 10分钟执行一次
private void checkDevice() { private void checkDevice() {
logger.info("zny checkDevice"); logger.info("zny checkDevice");
//checkNoDataDevice("2345080","2345068","2410190");
//checkNotGoodDevice("2412254","2412272"); //checkNotGoodDevice("2412254","2412272");
checkNotGoodDevice("2412270","2412272"); if(StringUtils.hasText(checkList) && StringUtils.hasText(referList)) {
String[] checkDevices = checkList.split(",");
String[] referDevices = referList.split(",");
for (int i = 0; i < checkDevices.length && i < referDevices.length; i++) {
checkNotGoodDevice(checkDevices[i], referDevices[i]);
}
}
//checkNoDataDevice("2345084","2415276","2345076"); //checkNoDataDevice("2345084","2415276","2345076");
//checkNoDataDevice("2345085","2345068","2345075");
} }
void checkNoDataDevice(String noDataDeviceId, String refDeviceId1, String refDeviceId2){ void checkNoDataDevice(String noDataDeviceId, String refDeviceId1, String refDeviceId2){

View File

@ -41,4 +41,7 @@ ntrip_server.port = 11100
sim.url = http://120.78.169.220:8089 sim.url = http://120.78.169.220:8089
sim.username = gzyzdz sim.username = gzyzdz
sim.key = 632629d1269a202c9d49a574623e4e4c sim.key = 632629d1269a202c9d49a574623e4e4c
abnormal.check_list = 2412270
abnormal.refer_list = 2412272