#update
This commit is contained in:
@@ -7,6 +7,8 @@ import java.util.concurrent.Executor;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.maibu.core.business.*;
|
||||
import com.maibu.mapper.*;
|
||||
import com.maibu.service.impl.IotDeviceCommonService;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -17,22 +19,9 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import com.maibu.constant.FastBeeConstant;
|
||||
import com.maibu.core.business.AlarmOrderConfig;
|
||||
import com.maibu.core.business.DevicePlan;
|
||||
import com.maibu.core.business.DevicePlanTask;
|
||||
import com.maibu.core.business.DeviceRunParam;
|
||||
import com.maibu.core.business.ErrorIdentificationStandard;
|
||||
import com.maibu.core.business.OrderModel;
|
||||
import com.maibu.core.domain.entity.SysSite;
|
||||
import com.maibu.core.enums.DeviceTaskStaus;
|
||||
import com.maibu.influxdb.util.InfluxDBUtil;
|
||||
import com.maibu.mapper.AlarmOrderConfigMapper;
|
||||
import com.maibu.mapper.DevicePlanMapper;
|
||||
import com.maibu.mapper.DevicePlanTaskMapper;
|
||||
import com.maibu.mapper.DeviceRunParamMapper;
|
||||
import com.maibu.mapper.ErrorIdentificationStandardMapper;
|
||||
import com.maibu.mapper.OrderModelMapper;
|
||||
import com.maibu.mapper.SysSiteMapper;
|
||||
import com.maibu.memory.GlobalMemory;
|
||||
import com.maibu.memory.SiteMemory;
|
||||
import com.maibu.mqtt.MqttClientUtil;
|
||||
@@ -73,6 +62,16 @@ public class InitThread implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private DeviceRunParamMapper deviceRunParamMapper;
|
||||
|
||||
@Autowired
|
||||
private IotDeviceCommonMapper iotDeviceCommonMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceProductMapper deviceProductMapper;
|
||||
|
||||
@Autowired
|
||||
private SysDeviceModelMapper deviceModelMapper;
|
||||
|
||||
@Autowired
|
||||
private ErrorIdentificationStandardMapper errorIdentificationStandardMapper;
|
||||
@Autowired
|
||||
@@ -145,9 +144,9 @@ public class InitThread implements ApplicationRunner {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
// commonDeviceMonitorExecutor.execute(() -> {
|
||||
// commonService.commonDeviceMonitor();
|
||||
// });
|
||||
commonDeviceMonitorExecutor.execute(() -> {
|
||||
commonService.commonDeviceMonitor();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,6 +167,44 @@ public class InitThread implements ApplicationRunner {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//外部设备
|
||||
List<IoTCommonDevice> ioTCommonDeviceList = iotDeviceCommonMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(ioTCommonDeviceList)) {
|
||||
ioTCommonDeviceList.forEach(x -> {
|
||||
Long orgId = x.getOrgId();
|
||||
Long siteId = x.getSiteId();
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(orgId, siteId);
|
||||
if (siteMemory != null) {
|
||||
siteMemory.saveCommonDevice(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
//产品
|
||||
List<Product> productList = deviceProductMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(productList)) {
|
||||
productList.forEach(x -> {
|
||||
Long orgId = x.getOrgId();
|
||||
Long siteId = x.getSiteId();
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(orgId, siteId);
|
||||
if (siteMemory != null) {
|
||||
siteMemory.saveProduct(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
//设备模型
|
||||
List<DeviceModel> deviceModelList = deviceModelMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(deviceModelList)) {
|
||||
deviceModelList.forEach(x -> {
|
||||
Long orgId = x.getOrgId();
|
||||
Long siteId = x.getSiteId();
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(orgId, siteId);
|
||||
if (siteMemory != null) {
|
||||
siteMemory.saveDeviceModel(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
//车辆参数
|
||||
List<DeviceRunParam> deviceRunParamList = deviceRunParamMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(deviceRunParamList)) {
|
||||
deviceRunParamList.forEach(x -> {
|
||||
@@ -179,7 +216,7 @@ public class InitThread implements ApplicationRunner {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//错误标准
|
||||
List<ErrorIdentificationStandard> standadList = errorIdentificationStandardMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(standadList)) {
|
||||
standadList.forEach(x -> {
|
||||
@@ -191,7 +228,7 @@ public class InitThread implements ApplicationRunner {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//订单模型
|
||||
List<OrderModel> orderModelList = orderModelMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(orderModelList)) {
|
||||
orderModelList.forEach(x -> {
|
||||
@@ -203,7 +240,7 @@ public class InitThread implements ApplicationRunner {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//告警订单配置
|
||||
List<AlarmOrderConfig> alarmOrderList = alarmOrderConfigMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(alarmOrderList)) {
|
||||
alarmOrderList.forEach(x -> {
|
||||
|
||||
Reference in New Issue
Block a user