#update
This commit is contained in:
@@ -124,7 +124,7 @@ public class DeviceTaskController extends BaseController {
|
||||
return AjaxResult.success(deviceTaskService.createDeviceTask(dto, getLoginUser().getUsername()));
|
||||
}
|
||||
|
||||
@PostMapping("/createRegionDeviceTask")
|
||||
@PostMapping("/createRegionDefaultTask")
|
||||
public AjaxResult createRegionDeviceTask(@RequestBody DeviceTaskCommandDTO dto) {
|
||||
String deviceId = dto.getDeviceId();
|
||||
Long siteId = dto.getSiteId();
|
||||
@@ -176,4 +176,25 @@ public class DeviceTaskController extends BaseController {
|
||||
return AjaxResult.success(deviceTaskService.recoveryTask(dto, getUsername()));
|
||||
}
|
||||
|
||||
@PostMapping("/backToRestPoint")
|
||||
public AjaxResult backToRestPoint(@RequestBody DeviceTaskCommandDTO dto) {
|
||||
String deviceId = dto.getDeviceId();
|
||||
Long siteId = dto.getSiteId();
|
||||
Long orgId = dto.getOrgId();
|
||||
if (StringUtils.isEmpty(deviceId)) {
|
||||
return AjaxResult.error("deviceId为空!");
|
||||
}
|
||||
if (siteId == null) {
|
||||
return AjaxResult.error("siteId为空!");
|
||||
}
|
||||
if (orgId == null) {
|
||||
return AjaxResult.error("orgId为空!");
|
||||
}
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(orgId, siteId);
|
||||
if (siteMemory.hasTask(deviceId)) {
|
||||
return AjaxResult.error("当前设备存在任务!");
|
||||
}
|
||||
return AjaxResult.success(deviceTaskService.backToRestPoint(dto, getLoginUser().getUsername()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,14 +5,12 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.checkerframework.checker.units.qual.s;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
@@ -26,7 +24,6 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.maibu.constant.FastBeeConstant;
|
||||
import com.maibu.core.business.AlarmOrderConfig;
|
||||
import com.maibu.core.business.Device;
|
||||
import com.maibu.core.business.DeviceModel;
|
||||
import com.maibu.core.business.DevicePlan;
|
||||
import com.maibu.core.business.DevicePlanTask;
|
||||
@@ -35,9 +32,12 @@ import com.maibu.core.business.ErrorIdentificationStandard;
|
||||
import com.maibu.core.business.IoTCommonDevice;
|
||||
import com.maibu.core.business.OrderModel;
|
||||
import com.maibu.core.business.Product;
|
||||
import com.maibu.core.business.WorkRecord;
|
||||
import com.maibu.core.domain.entity.SysParam;
|
||||
import com.maibu.core.domain.entity.SysSite;
|
||||
import com.maibu.core.domain.map.SiteMapInfo;
|
||||
import com.maibu.core.enums.DeviceTaskStaus;
|
||||
import com.maibu.core.enums.RouteType;
|
||||
import com.maibu.influxdb.util.InfluxDBUtil;
|
||||
import com.maibu.mapper.AlarmOrderConfigMapper;
|
||||
import com.maibu.mapper.DevicePlanMapper;
|
||||
@@ -47,9 +47,11 @@ import com.maibu.mapper.DeviceRunParamMapper;
|
||||
import com.maibu.mapper.ErrorIdentificationStandardMapper;
|
||||
import com.maibu.mapper.IotDeviceCommonMapper;
|
||||
import com.maibu.mapper.OrderModelMapper;
|
||||
import com.maibu.mapper.SiteMapInfoMapper;
|
||||
import com.maibu.mapper.SysDeviceModelMapper;
|
||||
import com.maibu.mapper.SysParamMapper;
|
||||
import com.maibu.mapper.SysSiteMapper;
|
||||
import com.maibu.mapper.WorkRecordMapper;
|
||||
import com.maibu.memory.GlobalMemory;
|
||||
import com.maibu.memory.SiteMemory;
|
||||
import com.maibu.mybatis.LambdaQueryWrapperX;
|
||||
@@ -57,7 +59,6 @@ import com.maibu.service.DevicePlanTaskMonitorService;
|
||||
import com.maibu.service.DeviceThreadService;
|
||||
import com.maibu.service.impl.IotDeviceCommonService;
|
||||
|
||||
import cn.hutool.core.io.IORuntimeException;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -75,6 +76,9 @@ public class InitThread implements ApplicationRunner {
|
||||
@Resource(name = FastBeeConstant.TASK.MAP_MESSAGE_PUSH)
|
||||
private Executor mapMessagePushExecutor;
|
||||
|
||||
@Resource(name = FastBeeConstant.TASK.AUTO_RULE)
|
||||
private Executor autoRuleExecutor;
|
||||
|
||||
@Resource(name = FastBeeConstant.TASK.COMMON_DEVICE_MONITOR)
|
||||
private Executor commonDeviceMonitorExecutor;
|
||||
|
||||
@@ -96,6 +100,9 @@ public class InitThread implements ApplicationRunner {
|
||||
@Autowired
|
||||
private SysSiteMapper sysSiteMapper;
|
||||
|
||||
@Autowired
|
||||
private SiteMapInfoMapper siteMapInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceRunParamMapper deviceRunParamMapper;
|
||||
|
||||
@@ -111,7 +118,7 @@ public class InitThread implements ApplicationRunner {
|
||||
@Autowired
|
||||
private ErrorIdentificationStandardMapper errorIdentificationStandardMapper;
|
||||
@Autowired
|
||||
|
||||
|
||||
private OrderModelMapper orderModelMapper;
|
||||
@Autowired
|
||||
private AlarmOrderConfigMapper alarmOrderConfigMapper;
|
||||
@@ -125,6 +132,9 @@ public class InitThread implements ApplicationRunner {
|
||||
@Autowired
|
||||
private SysParamMapper sysParamMapper;
|
||||
|
||||
@Autowired
|
||||
private WorkRecordMapper workRecordMapper;
|
||||
|
||||
@Value("${influxdb.url}")
|
||||
private String influxDBUrl;
|
||||
|
||||
@@ -162,14 +172,21 @@ public class InitThread implements ApplicationRunner {
|
||||
}
|
||||
|
||||
private void init() throws Exception {
|
||||
//初始化系统参数
|
||||
// 初始化系统参数
|
||||
initSystemParam();
|
||||
|
||||
initDefaultWorkRecord();
|
||||
|
||||
// 初始化InfluxDBUtil
|
||||
GlobalMemory.influxDBUtil = new InfluxDBUtil(influxDBUrl, influxDBToken, influxDBOrg, influxDBBucket);
|
||||
|
||||
GlobalMemory.initMqttDeviceMonitor(mqttHostUrl, mqttClientId, mqttUsername, mqttPassword);
|
||||
|
||||
// 规则触发线程
|
||||
autoRuleExecutor.execute(() -> {
|
||||
deviceThreadService.autoRule();
|
||||
});
|
||||
|
||||
// 地图监控推送
|
||||
mapMessagePushExecutor.execute(() -> {
|
||||
deviceThreadService.mapMessagePush();
|
||||
@@ -225,6 +242,19 @@ public class InitThread implements ApplicationRunner {
|
||||
});
|
||||
}
|
||||
|
||||
// 场站的 地图配置信息
|
||||
List<SiteMapInfo> siteMapInfoList = siteMapInfoMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(siteMapInfoList)) {
|
||||
siteMapInfoList.forEach(x -> {
|
||||
Long orgId = x.getOrgId();
|
||||
Long siteId = x.getSiteId();
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(orgId, siteId);
|
||||
if (siteMemory != null) {
|
||||
siteMemory.getSysSite().setSiteMapInfo(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 外部设备
|
||||
List<IoTCommonDevice> ioTCommonDeviceList = iotDeviceCommonMapper.selectList();
|
||||
if (!CollectionUtils.isEmpty(ioTCommonDeviceList)) {
|
||||
@@ -391,4 +421,40 @@ public class InitThread implements ApplicationRunner {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void initDefaultWorkRecord() throws IOException {
|
||||
LambdaQueryWrapper<WorkRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
List<WorkRecord> list = workRecordMapper.selectList(queryWrapper);
|
||||
try {
|
||||
// 读取resource目录下的dsystemParam.json文件
|
||||
org.springframework.core.io.Resource resource = resourceLoader
|
||||
.getResource("classpath:workRecordTemplete.json");
|
||||
// 使用fastjson2转换为DeviceConfig对象
|
||||
String jsonContent;
|
||||
jsonContent = IoUtil.readUtf8(resource.getInputStream());
|
||||
List<WorkRecord> records = JSON.parseArray(jsonContent, WorkRecord.class);
|
||||
List<WorkRecord> saveList = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
saveList.addAll(records);
|
||||
} else {
|
||||
Map<String, List<WorkRecord>> map = list.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(workRecord -> workRecord.getRouteType() != null)
|
||||
.collect(Collectors.groupingBy(
|
||||
workRecord -> workRecord.getRouteType().toString()));
|
||||
if (!CollectionUtils.isEmpty(records)) {
|
||||
records.forEach(x -> {
|
||||
if (!map.containsKey(x.getRouteType())) {
|
||||
x.setUserId(1L);
|
||||
saveList.add(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
workRecordMapper.saveOrUpdateBatch(saveList);
|
||||
} catch (Exception e) {
|
||||
log.error("初始化系统参数失败", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.maibu.core.business.Device;
|
||||
import com.maibu.core.business.DevicePlan;
|
||||
import com.maibu.core.business.DevicePlanTask;
|
||||
@@ -26,20 +28,26 @@ import com.maibu.core.business.device.NettyDevice;
|
||||
import com.maibu.core.business.dto.DeviceTaskCommandDTO;
|
||||
import com.maibu.core.domain.entity.SysRegion;
|
||||
import com.maibu.core.domain.entity.SysSite;
|
||||
import com.maibu.core.domain.map.RestPoint;
|
||||
import com.maibu.core.domain.map.SiteMapInfo;
|
||||
import com.maibu.core.domain.model.LoginUser;
|
||||
import com.maibu.core.enums.DeviceTaskStaus;
|
||||
import com.maibu.core.enums.RouteType;
|
||||
import com.maibu.dto.DevicePlanStatisticsDTO;
|
||||
import com.maibu.dto.DevicePlanTaskStatisticsDTO;
|
||||
import com.maibu.dto.DeviceTaskQueryDTO;
|
||||
import com.maibu.dto.DeviceWorkStatisticsDTO;
|
||||
import com.maibu.exception.ServiceException;
|
||||
import com.maibu.mapper.DeviceMapper;
|
||||
import com.maibu.mapper.DevicePlanMapper;
|
||||
import com.maibu.mapper.DevicePlanTaskMapper;
|
||||
import com.maibu.mapper.SiteMapInfoMapper;
|
||||
import com.maibu.mapper.SysRegionMapper;
|
||||
import com.maibu.mapper.SysSiteMapper;
|
||||
import com.maibu.mapper.WorkRecordMapper;
|
||||
import com.maibu.memory.GlobalMemory;
|
||||
import com.maibu.memory.SiteMemory;
|
||||
import com.maibu.utils.MessageUtils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -68,6 +76,8 @@ public class DeviceTaskService {
|
||||
@Autowired
|
||||
private SysRegionMapper sysRegionMapper;
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
public int insertOrUpdate(DevicePlan devicePlan, LoginUser loginUser) {
|
||||
Long id = devicePlan.getId();
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(devicePlan.getOrgId(), devicePlan.getSiteId());
|
||||
@@ -470,6 +480,12 @@ public class DeviceTaskService {
|
||||
task.setCreateTime(LocalDateTime.now());
|
||||
task.setRouteId(dto.getRouteId());
|
||||
task.setStartTime(dto.getStartTime());
|
||||
|
||||
WorkRecord workRecord = workRecordMapper.selectById(dto.getRouteId());
|
||||
if (workRecord != null) {
|
||||
task.setRouteType(workRecord.getRouteType());
|
||||
}
|
||||
|
||||
devicePlanTaskMapper.saveOrUpdate(task);
|
||||
if (dto.getOrgId() == null) {
|
||||
SysSite site = sysSiteMapper.selectById(dto.getSiteId());
|
||||
@@ -487,11 +503,22 @@ public class DeviceTaskService {
|
||||
queryWrapper.eq(SysRegion::getId, dto.getRegionId());
|
||||
SysRegion region = sysRegionMapper.selectOne(queryWrapper);
|
||||
|
||||
if (region == null || region.getBindRoute() == null) {
|
||||
throw new RuntimeException("区域未绑定线路!");
|
||||
if (region == null) {
|
||||
throw new RuntimeException("区域未找到!");
|
||||
}
|
||||
Long routeId = dto.getRouteId();
|
||||
if (routeId == null) {
|
||||
routeId = region.getDefaultRoute();
|
||||
}
|
||||
|
||||
if (dto.getOrgId() == null) {
|
||||
SysSite site = sysSiteMapper.selectById(dto.getSiteId());
|
||||
if (site != null) {
|
||||
dto.setOrgId(site.getOrgId());
|
||||
}
|
||||
}
|
||||
DevicePlanTask task = new DevicePlanTask();
|
||||
task.setRouteId(region.getBindRoute());
|
||||
task.setRouteId(routeId);
|
||||
task.setOrgId(dto.getOrgId());
|
||||
task.setSiteId(dto.getSiteId());
|
||||
task.setTaskStaus(DeviceTaskStaus.NEW);
|
||||
@@ -499,13 +526,14 @@ public class DeviceTaskService {
|
||||
task.setCreateBy(username);
|
||||
task.setCreateTime(LocalDateTime.now());
|
||||
task.setStartTime(dto.getStartTime());
|
||||
devicePlanTaskMapper.saveOrUpdate(task);
|
||||
if (dto.getOrgId() == null) {
|
||||
SysSite site = sysSiteMapper.selectById(dto.getSiteId());
|
||||
if (site != null) {
|
||||
dto.setOrgId(site.getOrgId());
|
||||
}
|
||||
|
||||
WorkRecord workRecord = workRecordMapper.selectById(region.getDefaultRoute());
|
||||
if (workRecord != null) {
|
||||
task.setRouteType(workRecord.getRouteType());
|
||||
}
|
||||
|
||||
devicePlanTaskMapper.saveOrUpdate(task);
|
||||
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(task.getOrgId(), task.getSiteId());
|
||||
siteMemory.addDevicePlanPrepare(task);
|
||||
return task.getId();
|
||||
@@ -584,4 +612,60 @@ public class DeviceTaskService {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Long backToRestPoint(DeviceTaskCommandDTO dto, String username) {
|
||||
|
||||
if (dto.getOrgId() == null) {
|
||||
SysSite site = sysSiteMapper.selectById(dto.getSiteId());
|
||||
if (site != null) {
|
||||
dto.setOrgId(site.getOrgId());
|
||||
}
|
||||
}
|
||||
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(dto.getOrgId(), dto.getSiteId());
|
||||
SiteMapInfo siteMapInfo;
|
||||
if (siteMemory == null) {
|
||||
throw new ServiceException(MessageUtils.message("任务下发出错!"));
|
||||
}
|
||||
|
||||
siteMapInfo = siteMemory.getSysSite().getSiteMapInfo();
|
||||
|
||||
if (siteMapInfo == null || CollectionUtils.isEmpty(siteMapInfo.getRestPoints())) {
|
||||
throw new ServiceException(MessageUtils.message("当前机器未配置返回点!"));
|
||||
}
|
||||
|
||||
List<RestPoint> restPoints = objectMapper.convertValue(
|
||||
siteMapInfo.getRestPoints(),
|
||||
new TypeReference<List<RestPoint>>() {
|
||||
});
|
||||
|
||||
RestPoint switchRestPoint = restPoints.stream()
|
||||
.filter(x -> dto.getDeviceId().equals(x.getBindDeviceId())).findFirst().orElse(null);
|
||||
|
||||
if (switchRestPoint == null) {
|
||||
throw new ServiceException(MessageUtils.message("当前机器未配置返回点!"));
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<WorkRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(WorkRecord::getRouteType, RouteType.BACK_TO_REST_POINT);
|
||||
WorkRecord workRecord = workRecordMapper.selectOne(queryWrapper);
|
||||
|
||||
DevicePlanTask task = new DevicePlanTask();
|
||||
|
||||
task.setRouteId(workRecord.getId());
|
||||
task.setRouteType(workRecord.getRouteType());
|
||||
|
||||
task.setBackTaskPoint(switchRestPoint);
|
||||
task.setOrgId(dto.getOrgId());
|
||||
task.setSiteId(dto.getSiteId());
|
||||
task.setTaskStaus(DeviceTaskStaus.NEW);
|
||||
task.setDeviceId(dto.getDeviceId());
|
||||
task.setCreateBy(username);
|
||||
task.setCreateTime(LocalDateTime.now());
|
||||
task.setStartTime(dto.getStartTime());
|
||||
devicePlanTaskMapper.saveOrUpdate(task);
|
||||
|
||||
siteMemory.addDevicePlanPrepare(task);
|
||||
return task.getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.maibu.core.business.dto.DeviceMapPushDTO;
|
||||
import com.maibu.core.business.dto.DeviceTaskCommandDTO;
|
||||
import com.maibu.core.business.dto.WebMapMessageDTO;
|
||||
import com.maibu.core.business.dto.WebOlineStatusMessageDTO;
|
||||
import com.maibu.core.enums.*;
|
||||
@@ -40,8 +41,13 @@ import com.maibu.core.business.ErrorIdentificationStandard;
|
||||
import com.maibu.core.business.alarm_center.AlarmMessage;
|
||||
import com.maibu.core.business.device.NettyDevice;
|
||||
import com.maibu.core.business.inter.WebsocketMesDispather;
|
||||
import com.maibu.core.domain.AjaxResult;
|
||||
import com.maibu.core.domain.rule.ActionConfig;
|
||||
import com.maibu.core.domain.rule.IotAutoRule;
|
||||
import com.maibu.core.domain.rule.TriggerConditions;
|
||||
import com.maibu.core.host.HeartBeatDTO;
|
||||
import com.maibu.core.host.LocationMessage;
|
||||
import com.maibu.core.host.VehicleMessage;
|
||||
import com.maibu.core.redis.RedisCache;
|
||||
import com.maibu.dto.DeviceErrorPushDTO;
|
||||
import com.maibu.dto.DeviceTaskStatusMessageDTO;
|
||||
@@ -95,6 +101,9 @@ public class DeviceThreadService {
|
||||
@Autowired
|
||||
private DeviceRunStatisticsMapper deviceRunStatisticsMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceTaskService deviceTaskService;
|
||||
|
||||
public void deviceErrorMonitor() throws InterruptedException, IOException {
|
||||
initStandard();
|
||||
|
||||
@@ -456,4 +465,101 @@ public class DeviceThreadService {
|
||||
}, 0, 100, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则触发自动判断
|
||||
*/
|
||||
public void autoRule() {
|
||||
executor.scheduleWithFixedDelay(() -> {
|
||||
try {
|
||||
List<SiteMemory> list = GlobalMemory.getAllSiteMemory();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(x -> {
|
||||
List<IotAutoRule> rules = x.getAllIotAutoRule();
|
||||
if (!CollectionUtils.isEmpty(rules)) {
|
||||
rules.forEach(rule -> {
|
||||
// 根据不同的 类型区分处理方式
|
||||
handleAutoRule(rule, x);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("执行规则出发线程错误:{}", e.getMessage());
|
||||
}
|
||||
}, 0, 500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public void handleAutoRule(IotAutoRule rule, SiteMemory siteMemory) {
|
||||
|
||||
if (RuleType.LOW_BATTERY_RETURN.equals(rule.getRuleType())) {
|
||||
TriggerConditions conditions = rule.getConditions();
|
||||
String key = conditions.getKey();
|
||||
CompareEnum compareType = conditions.getOperator();
|
||||
String compareValue = conditions.getValue();
|
||||
List<VehicleMessage> vList = siteMemory.getAllVehicleMessage();
|
||||
if (!CollectionUtils.isEmpty(vList)) {
|
||||
vList.forEach(x -> {
|
||||
String deviceId = x.getDeviceId();
|
||||
String value = classFieldFinding(key, x);
|
||||
boolean result = CompareUtils.compare(compareType, value, compareValue);
|
||||
if (result) {
|
||||
ActionConfig aConfig = rule.getActionConfig();
|
||||
if (aConfig != null && aConfig.getActionType() != null) {
|
||||
ActionType actionType = aConfig.getActionType();
|
||||
if (ActionType.BACK_TO_REST.equals(actionType)) {
|
||||
if (siteMemory.hasTask(deviceId)) {
|
||||
return;
|
||||
}
|
||||
DeviceTaskCommandDTO dto = new DeviceTaskCommandDTO();
|
||||
dto.setDeviceId(deviceId);
|
||||
dto.setOrgId(siteMemory.getSysSite().getOrgId());
|
||||
dto.setSiteId(siteMemory.getSysSite().getId());
|
||||
|
||||
deviceTaskService.backToRestPoint(dto, "system");
|
||||
}
|
||||
if (ActionType.AUTO_TASK.equals(actionType)) {
|
||||
if (siteMemory.hasTask(deviceId)) {
|
||||
return;
|
||||
}
|
||||
Long routeId = aConfig.getRouteId();
|
||||
DeviceTaskCommandDTO dto = new DeviceTaskCommandDTO();
|
||||
dto.setDeviceId(deviceId);
|
||||
dto.setOrgId(siteMemory.getSysSite().getOrgId());
|
||||
dto.setSiteId(siteMemory.getSysSite().getId());
|
||||
dto.setRouteId(routeId);
|
||||
deviceTaskService.createDeviceTask(dto, "system");
|
||||
}
|
||||
if (ActionType.ALARM.equals(actionType)) {
|
||||
|
||||
}
|
||||
if (ActionType.SEND_COMMAND.equals(actionType)) {
|
||||
|
||||
}
|
||||
if (ActionType.WORK_ORDER.equals(actionType)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static String classFieldFinding(String fieldName, VehicleMessage history) {
|
||||
try {
|
||||
// 1. 获取类的Class对象
|
||||
Class<?> vehicleClass = VehicleMessage.class;
|
||||
Field field = vehicleClass.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
Object value = field.get(history);
|
||||
return (String) value;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
System.out.println("获取字段失败: " + e.getMessage());
|
||||
log.error("获取属性值失败:{}", e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user