perf: 转换通的和不通的可以变化显示

main
huangfeng 6 months ago
parent 72f65ab4cb
commit 3f1d8eab84

@ -7,9 +7,9 @@ import com.xydl.cac.entity.constants.Constants;
import com.xydl.cac.exception.BusinessException;
import com.xydl.cac.iec.IecServerService;
import com.xydl.cac.model.Response;
import com.xydl.cac.model.StaticVariable;
import com.xydl.cac.service.IcdFileConfigService;
import com.xydl.cac.service.IcdTransformService;
import com.xydl.cac.service.impl.IcdTransformServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -128,11 +128,15 @@ public class IecServerController extends BasicController {
public Response<List<IcdTransform>> listTransform() throws Exception {
List<IcdTransform> result = transformService.listTransform();
for (IcdTransform item : result) {
if (IcdTransformServiceImpl.rptFromActiveMap.containsKey(item.getRptFrom())) {
if (StaticVariable.rptFromActiveMap.containsKey(item.getRptFrom())) {
item.setFromActive(true);
} else {
item.setFromActive(false);
}
if (IcdTransformServiceImpl.rptToActiveMap.containsKey(item.getRptTo())) {
if (StaticVariable.rptToActiveMap.containsKey(item.getRptTo())) {
item.setToActive(true);
} else {
item.setToActive(false);
}
}
return Response.success(result);

@ -57,6 +57,24 @@ public class TestController extends BasicController {
return Response.success(StaticVariable.sensorLastDataMap);
}
@GetMapping("iecServerMap")
@ApiOperation("iecServerMap")
public Response<HashMap> iecServerMap() {
return Response.success(StaticVariable.iecServerMap);
}
@GetMapping("rptFromActiveMap")
@ApiOperation("rptFromActiveMap")
public Response<HashMap> rptFromActiveMap() {
return Response.success(StaticVariable.rptFromActiveMap);
}
@GetMapping("rptToActiveMap")
@ApiOperation("rptToActiveMap")
public Response<HashMap> rptToActiveMap() {
return Response.success(StaticVariable.rptToActiveMap);
}
@GetMapping("clearMap")
@ApiOperation("clearMap")
public void clearMap() {

@ -2,6 +2,7 @@ package com.xydl.cac.iec;
import com.beanit.iec61850bean.*;
import com.xydl.cac.entity.IcdTransform;
import com.xydl.cac.model.StaticVariable;
import com.xydl.cac.service.IcdTransformService;
import com.xydl.cac.service.impl.IcdTransformServiceImpl;
import lombok.extern.slf4j.Slf4j;
@ -57,7 +58,7 @@ public class IecServer implements ServerEventListener {
if (ref.startsWith(item.getRptFrom())) {
ref = ref.replace(item.getRptFrom(), item.getRptTo());
rptTo = item.getRptTo();
IcdTransformServiceImpl.rptFromActiveMap.put(item.getRptFrom(), "1");
StaticVariable.rptFromActiveMap.put(item.getRptFrom(), "1");
break;
}
}
@ -67,8 +68,10 @@ public class IecServer implements ServerEventListener {
node.setValueFrom(bda);
List<BasicDataAttribute> bdas = new ArrayList<>();
bdas.add(node);
IcdTransformServiceImpl.rptToActiveMap.put(rptTo, "1");
StaticVariable.rptToActiveMap.put(rptTo, "1");
serverSap.setValues(bdas);
} else {
StaticVariable.rptToActiveMap.remove(rptTo);
}
}

@ -22,6 +22,8 @@ public class StaticVariable {
public static HashMap<String, String> doneWarnMap = new HashMap<>();
public static HashMap<Integer, IecClient> realTimeClientMap = new HashMap<>();
public static int shutdown = 0;
public static HashMap<String, String> rptFromActiveMap = new HashMap<>();
public static HashMap<String, String> rptToActiveMap = new HashMap<>();
public static HashMap<String, String> unit_Cache = new HashMap<>();
public static List<ModevType> modevType_Cache = null;

@ -11,8 +11,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
@ -24,8 +22,6 @@ public class IcdTransformServiceImpl implements IcdTransformService {
@Resource
IcdTransformRepository transformRepository;
public static HashMap<String, String> rptFromActiveMap = new HashMap<>();
public static HashMap<String, String> rptToActiveMap = new HashMap<>();
@Override
@CacheEvict(cacheNames = {"listTransform"}, allEntries = true)

Loading…
Cancel
Save