123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /*
- package com.sooka.sponest.event.utils;
- import com.ruoyi.common.core.utils.SpringUtils;
- import com.ruoyi.common.core.utils.StringUtils;
- import com.ruoyi.common.redis.service.RedisService;
- import com.sooka.sponest.event.centereventteventcatalogue.service.ICentereventTEventcatalogueService;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.scheduling.annotation.EnableScheduling;
- import org.springframework.scheduling.annotation.Scheduled;
- import java.util.HashMap;
- import java.util.Map;
- import java.util.concurrent.TimeUnit;
- */
- /**
- * @Auther: mjq
- * @Date: 2023/9/12 - 09 - 12 - 10:08
- * @Description: com.sooka.sponest.event.utils
- * @version: 1.0
- *//*
- @Configuration
- @EnableScheduling
- //@RestController
- //@RequestMapping("/testload")
- public class ScheduleTaskUtil {
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
- @Autowired
- private ICentereventTEventcatalogueService centereventTEventcatalogueService;
- static final String DOWN_LOCK = "downlod:lock";
- static final String VALUE_LOCK = "valueLock";
- @Scheduled(cron = "0 10 0 * * ?")
- //@GetMapping("/down")
- public void runTask() {
- long startMill = System.currentTimeMillis();
- // 读取缓存
- RedisService redis = SpringUtils.getBean(RedisService.class);
- String lock = redis.getCacheObject(DOWN_LOCK);
- if (StringUtils.isBlank(lock)) {
- redis.setCacheObject(DOWN_LOCK, VALUE_LOCK);
- Map<String, Object> params = new HashMap<>();
- params.put("taskValue", "1");
- centereventTEventcatalogueService.downloadsCommon(params);
- }
- redis.setCacheObject(DOWN_LOCK, (System.currentTimeMillis() - startMill), (long) 3600 * 12, TimeUnit.SECONDS);
- }
- }
- */
|