1
zyy
21 hours ago 4fefff17528a878d345ff3311c297a66a671b8d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.yami.trading.huobi.task;
 
 
import com.yami.trading.bean.data.domain.Realtime;
import com.yami.trading.bean.item.domain.Item;
import com.yami.trading.huobi.data.DataCache;
import com.yami.trading.huobi.data.job.StockGetDataJob;
import com.yami.trading.service.data.DataService;
import com.yami.trading.service.item.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.util.List;
import java.util.stream.Collectors;
 
@Component
@Lazy(value = false)
@Slf4j
public class ActiveRealtimeBlankRepairTask {
    @Autowired
    private StockGetDataJob stockGetDataJob;
 
    @Autowired
    private ItemService itemService;
    @Qualifier("dataService")
    @Autowired
    private DataService dataService;
//    @Scheduled(cron = "*/3 * * ? * *")
    @Async
    public void doStockTask() throws InterruptedException {
        log.debug("ActiveRealtimeBlankRepairTask 正在对已经激活的,重新补充实时价格数据");
        List<Item> stocks = itemService.listManualActive();
        for(Item item  : stocks){
            Realtime realtime = DataCache.getRealtime(item.getSymbol());
            if(realtime == null){
                log.info("ActiveRealtimeBlankRepairTask  重新补充实时价格数据 :{}", item.getSymbol());
                stockGetDataJob.realtimeHandle(item.getRemarks());
            }
        }
 
 
    }
 
 
 
 
 
}