package com.zbkj.admin.service.impl; import com.alibaba.fastjson.JSONObject; import com.zbkj.admin.service.EbVehicleInfoService; import com.zbkj.common.utils.RedisUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @Service public class DataService { @Autowired private EbVehicleInfoService ebVehicleInfoService; @Autowired private RedisUtil redisUtil; @Scheduled(fixedDelay = 1000 * 60L) public void refreshData() { if (redisUtil.exists("screen-data")) { redisUtil.set("screen-data", JSONObject.toJSONString(ebVehicleInfoService.screen("建立连接返回数据"))); } } }