1. 更新设备缓存

2. 更新linux安装手册
This commit is contained in:
谷成伟 2024-11-01 17:03:32 +08:00
parent 0b53a804d9
commit c40d2d55b2
2 changed files with 55 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@ -42,7 +43,7 @@ public class CacheService {
/**
* 设备缓存信息
*/
private final List<DeviceInfoCache> deviceInfoCaches = new ArrayList<DeviceInfoCache>();
private final List<DeviceInfoCache> deviceInfoCaches = Collections.synchronizedList(new ArrayList<>());
/**
* 设备CODE索引用于通过设备CODE访问设备缓存信息
@ -115,5 +116,32 @@ public class CacheService {
return null;
}
/**
* 刷新指定设备ID的设备缓存如果缓存不存在则添加
* @param deviceId
*/
public void refreshDeviceCache(Long deviceId) {
SysEquipment equipment = sysEquipmentMapper.selectById(deviceId);
if (equipment != null) {
DeviceInfoCache deviceInfoCache = new DeviceInfoCache();
deviceInfoCache.setDeviceId(equipment.getId());
deviceInfoCache.setDeviceCode(equipment.getCode());
deviceInfoCache.setDeviceName(equipment.getName());
deviceInfoCache.setObjectType(equipment.getObjectType());
deviceInfoCache.setParentDeviceId(equipment.getParentEquipmentId());
//如果是已经缓存过的设备直接缓存
Integer index = deviceIdIndex.get(deviceId);
if (index != null) {
deviceInfoCaches.set(index, deviceInfoCache);
}
else{
deviceInfoCaches.add(deviceInfoCache);
index = deviceInfoCaches.size();
deviceCodeIndex.put(deviceInfoCache.getDeviceCode(),index);
deviceIdIndex.put(equipment.getId(),index);
}
}
}
///-设备缓存=END---------------------------------------------------------------
}

View File

@ -32,7 +32,7 @@ OpenEuler的安装和Centos差不多这里不详细说明了就把几个
点击 `Done`完成分区配置。
> `Lanage Support` 这个需要勾上中文。
> `Language Support` 这个需要勾上中文。
![alt text](asserts/image-10.png)
@ -48,4 +48,28 @@ OpenEuler的安装和Centos差不多这里不详细说明了就把几个
## 系统配置
!> 未完待续
### 更新系统(不能访问外网请忽略)
```bash
yum update -y
```
### 关闭Selinux
除非你明确知道它是什么怎么配置,否则不建议开启。
```bash
setenforce 0
```
上面的命令是临时关闭仅在当前Session下有效使用它就不用重启了。
永久关闭的命令:
```bash
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
```
### 关闭防火墙
```bash
systemctl stop firewalld
systemctl disable firewalld
```