实时轨迹业务添加
parent
2cc014deb1
commit
429a07e2e3
|
@ -1,25 +1,20 @@
|
|||
package com.parseSystem.event;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dragon.common.redis.service.RedisService;
|
||||
import com.parseSystem.utils.SpringUtils;
|
||||
import com.parseSystem.vehicle.VehicleData;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* 事件处理接口
|
||||
*
|
||||
* @author 冯凯
|
||||
* @version 1.0
|
||||
* @description:
|
||||
|
@ -29,20 +24,16 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
@Log4j2
|
||||
public class EventHandlerService {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 事件处理map
|
||||
*/
|
||||
public static final Map<String, List<String>> eventMap = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 注册事件
|
||||
*
|
||||
* @param vin
|
||||
* @param eventServiceName
|
||||
*/
|
||||
|
@ -52,6 +43,7 @@ public class EventHandlerService {
|
|||
|
||||
/**
|
||||
* 移除事件
|
||||
*
|
||||
* @param vin
|
||||
* @param eventServiceName
|
||||
*/
|
||||
|
@ -61,6 +53,7 @@ public class EventHandlerService {
|
|||
|
||||
/**
|
||||
* 执行事件
|
||||
*
|
||||
* @param vehicleData
|
||||
*/
|
||||
public void executeEvent(VehicleData vehicleData) {
|
||||
|
@ -73,6 +66,7 @@ public class EventHandlerService {
|
|||
|
||||
/**
|
||||
* 获取事件列表
|
||||
*
|
||||
* @param vin
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
package com.parseSystem.event.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.dragon.common.redis.service.RedisService;
|
||||
import com.parseSystem.event.EventHandlerService;
|
||||
import com.parseSystem.event.VehicleEventService;
|
||||
import com.parseSystem.vehicle.VehicleData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
* 实时轨迹
|
||||
|
@ -15,6 +25,8 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service("runtimeTraceEvent")
|
||||
public class RuntimeTraceEvent extends EventHandlerService implements VehicleEventService {
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 实时轨迹事件执行逻辑
|
||||
|
@ -22,6 +34,6 @@ public class RuntimeTraceEvent extends EventHandlerService implements VehicleEve
|
|||
*/
|
||||
@Override
|
||||
public void executeEvent(VehicleData vehicleData) {
|
||||
System.out.println("你好实时轨迹");
|
||||
redisService.setCacheObject("runtimeTraceEvent_"+vehicleData.getVin(),vehicleData);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue