ffffff
parent
e5c4c0b9a4
commit
43f51881ca
|
@ -28,6 +28,10 @@
|
||||||
<groupId>com.couplet</groupId>
|
<groupId>com.couplet</groupId>
|
||||||
<artifactId>couplet-common-core</artifactId>
|
<artifactId>couplet-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.couplet</groupId>
|
||||||
|
<artifactId>couplet-common-business</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.couplet.common.redis.service;
|
package com.couplet.common.redis.service;
|
||||||
|
|
||||||
|
import com.couplet.common.domain.CoupletVehicleData;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.*;
|
import org.springframework.data.redis.core.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -19,6 +20,12 @@ public class RedisService {
|
||||||
@Resource
|
@Resource
|
||||||
public RedisTemplate redisTemplate;
|
public RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
public List<CoupletVehicleData> getList () {
|
||||||
|
return redisTemplate.opsForList().range("coupletMsgData", 0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存基本的对象,Integer、String、实体类等
|
* 缓存基本的对象,Integer、String、实体类等
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.couplet.common.core.domain.Result;
|
||||||
import com.couplet.common.domain.CoupletVehicleData;
|
import com.couplet.common.domain.CoupletVehicleData;
|
||||||
import com.couplet.common.domain.Vehicle;
|
import com.couplet.common.domain.Vehicle;
|
||||||
import com.couplet.common.domain.request.RealTimeDataRequest;
|
import com.couplet.common.domain.request.RealTimeDataRequest;
|
||||||
|
import com.couplet.common.redis.service.RedisService;
|
||||||
import com.couplet.common.security.utils.SecurityUtils;
|
import com.couplet.common.security.utils.SecurityUtils;
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -31,6 +32,8 @@ public class VehicleDetectionController {
|
||||||
private VehicleDetectionService vehicleDetectionService;
|
private VehicleDetectionService vehicleDetectionService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RabbitTemplate rabbitTemplate;
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
private final String REDIS_LIST_KEY = "coupletMsgData";
|
private final String REDIS_LIST_KEY = "coupletMsgData";
|
||||||
/*
|
/*
|
||||||
* @param :
|
* @param :
|
||||||
|
@ -65,7 +68,11 @@ public class VehicleDetectionController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("realData")
|
||||||
|
public Result<List<CoupletVehicleData>> realData(){
|
||||||
|
List<CoupletVehicleData> list = redisService.getList();
|
||||||
|
Result<List<CoupletVehicleData>> success = Result.success(list);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue