Helius
2021-11-02 32cd9fe7569d4bf40bd3ee4b13d1e2e5a50203de
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.xcong.excoin.quartz.job;
 
import com.xcong.excoin.modules.blackchain.service.TrxUsdtUpdateService;
import com.xcong.excoin.modules.blackchain.service.UsdtEthService;
import com.xcong.excoin.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.ExecutionException;
 
/**
 * 归集定时任务
 *
 * @author wzy
 * @date 2020-07-02
 **/
 
@Slf4j
@Component
@ConditionalOnProperty(prefix = "app", name = "block-job", havingValue = "true")
public class NotionalPoolingJob {
 
    @Resource
    private UsdtEthService usdtEthService;
 
    @Resource
    private RedisUtils redisUtils;
    @Resource
    private TrxUsdtUpdateService trxUsdtUpdateService;
 
    /**
     * usdt 归集
     */
   @Scheduled(cron = "0 15/30 * * * ? ")
    public void poolUsdtEth() {
        try {
            log.info("USDT归集开始");
            usdtEthService.pool();
            log.info("USDT归集结束");
        } catch (ExecutionException | InterruptedException e) {
            log.error("#usdt归集错误#", e);
        }
    }
 
//    @Scheduled(cron = "0 2/8 * * * ? ")
//    public void usdtEthPoolCheck() {
//        log.info("USDTETH归集结果扫描开始");
//        usdtEthService.usdtEthPoolCheck();
//    }
 
    @Scheduled(cron = "0 2/30 * * * ? ")
    public void poolEth() {
        try {
            usdtEthService.ethPool();
        } catch (ExecutionException | InterruptedException e) {
            log.info("#ETH归集错误#", e);
        }
    }
 
    /**
     *  归集TRC20
     */
    @Scheduled(cron = "0 1/5 * * * ? ")
    public void poolUsdtTrc20() {
        Object trc20_pool = redisUtils.get("TRC20_POOL");
        if(trc20_pool==null){
            return;
        }
        List<String> list = (List)trc20_pool;
        for(String address: list){
            trxUsdtUpdateService.poolByAddress(address);
        }
    }
}