fufanruiCommit

server_five_liuyunhu
ffr 2024-04-08 10:55:33 +08:00
parent 366d97e8d2
commit e270770029
4 changed files with 34 additions and 2 deletions

View File

@ -280,4 +280,10 @@ public class RedisService {
String key = "vin:"+realTimeDataRequest.getVin()+"userId:"+realTimeDataRequest.getUserId(); String key = "vin:"+realTimeDataRequest.getVin()+"userId:"+realTimeDataRequest.getUserId();
redisTemplate.opsForValue().set(key, realTimeDataRequest); redisTemplate.opsForValue().set(key, realTimeDataRequest);
} }
public void stopViewingData(Long userId,String vin) {
String key = "vin:"+vin+"userId:"+userId;
redisTemplate.delete(key);
}
} }

View File

@ -59,8 +59,13 @@ public class VehicleDetectionController {
vehicleDetectionService.monitorinData(vin); vehicleDetectionService.monitorinData(vin);
} }
/*
* @param :
* @return Result<List<CoupletVehicleData>>
* @author
* @description
* @date
*/
@PostMapping("realData") @PostMapping("realData")
public Result<List<CoupletVehicleData>> realData(){ public Result<List<CoupletVehicleData>> realData(){
List<CoupletVehicleData> list = redisService.getList(); List<CoupletVehicleData> list = redisService.getList();
@ -68,4 +73,16 @@ public class VehicleDetectionController {
return success; return success;
} }
/*
* @param vin:
* @return void
* @author
* @description
* @date
*/
@PostMapping("stopViewingData/{vin}")
public void stopViewingData(@PathVariable String vin){
vehicleDetectionService.stopViewingData(vin);
}
} }

View File

@ -10,4 +10,7 @@ public interface VehicleDetectionService {
List<Vehicle> detectionList(); List<Vehicle> detectionList();
void monitorinData(String vin); void monitorinData(String vin);
void stopViewingData(String vin);
} }

View File

@ -47,4 +47,10 @@ public class VehicleDetectionServiceImpl implements VehicleDetectionService{
} }
@Override
public void stopViewingData(String vin) {
Long userId = SecurityUtils.getUserId();
redisService.stopViewingData(userId,vin);
}
} }