| | |
| | | import lombok.extern.log4j.Log4j2; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Set; |
| | |
| | | public void updateStatus() { |
| | | long now = System.currentTimeMillis() / 1000; // 获取当前时间戳(秒) |
| | | Set<String> subscribeIds = redisTemplate.opsForZSet().rangeByScore("delay_queue:subscribe", 0, now); |
| | | if (subscribeIds != null) { |
| | | if (!CollectionUtils.isEmpty(subscribeIds)) { |
| | | subscribeIds.forEach(subscribeId -> { |
| | | technicianClient.updateStatus(2, Long.valueOf(subscribeId)); |
| | | technicianClient.updateStatus(3, Long.valueOf(subscribeId)); |
| | | }); |
| | | } |
| | | } |