xiaoyong931011
2023-05-19 e38fbe61f94f7be64caf40ffa99b52023b01b86f
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
package cc.mrbird.febs.job;
 
import cc.mrbird.febs.dapp.entity.DappFundFlowEntity;
import cc.mrbird.febs.dapp.mapper.DappFundFlowDao;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import cn.hutool.core.util.ObjectUtil;
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;
@Slf4j
@Component
@ConditionalOnProperty(prefix = "system", name = "online-transfer", havingValue = "true")
public class BnbTransferJob{
    /**
     * 搜索还未发生转账操作,但是记录已经更新没有产生HASH值的流水记录,并发起转账操作
     */
    @Autowired
    private DappFundFlowDao dappFundFlowDao;
    @Autowired
    private ChainProducer chainProducer;
 
    @Scheduled(cron = "0/30 * * * * ? ")
    public void BnbTransferAgain() {
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectByStateAndVersionAndFromHashLimitOne(2,2);
        if(ObjectUtil.isNotEmpty(dappFundFlowEntity)){
            Integer isReturn = dappFundFlowEntity.getIsReturn();
            if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == isReturn){
                chainProducer.sendBnbTransferTestMsg(dappFundFlowEntity.getId());
            }
        }
    }
 
}